CN101853142B - Identification method of USB device with virtual drive - Google Patents

Identification method of USB device with virtual drive Download PDF

Info

Publication number
CN101853142B
CN101853142B CN201010162529.5A CN201010162529A CN101853142B CN 101853142 B CN101853142 B CN 101853142B CN 201010162529 A CN201010162529 A CN 201010162529A CN 101853142 B CN101853142 B CN 101853142B
Authority
CN
China
Prior art keywords
usb device
usb
flag
state
request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201010162529.5A
Other languages
Chinese (zh)
Other versions
CN101853142A (en
Inventor
李志坚
余化鹏
邢保振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sichuan Jiuzhou Electric Group Co Ltd
Original Assignee
Sichuan Jiuzhou Electric Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sichuan Jiuzhou Electric Group Co Ltd filed Critical Sichuan Jiuzhou Electric Group Co Ltd
Priority to CN201010162529.5A priority Critical patent/CN101853142B/en
Publication of CN101853142A publication Critical patent/CN101853142A/en
Application granted granted Critical
Publication of CN101853142B publication Critical patent/CN101853142B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention relates to an identification method of a USB device with a virtual drive. When the USB device is plugged into a computer host, the processing flow of the USB device comprises the following steps: A. carrying out various initialization operations by the USB device; B. arranging identifiers; C. starting the USB device and determining the state of the identifiers in a memorizer; D. processing the request for acquiring character string descriptors sent by the computer host by the USB device; E. executing the operation of the USB virtual drive if the identifiers in the step D are in state 1; and F. executing the operation of a USB compound device if the identifiers in step D are in state 2. The invention has the advantage that by the principle and method, no matter whether the Windows operating system of the computer host is provided with the drive of the USB compound device with multiple interfaces or not, after the USB device is plugged into the host, the warning that the drive of the device can not be found can not pop up in the Windows operating system.

Description

A kind of recognition methods of the USB device with virtual drive
Technical field
The present invention relates to the communication technology of USB (Universal Serial BUS, USB (universal serial bus)) equipment and host computer, relate in particular to the recognition technology of USB equipment complex and host computer.
Background technology
USB device refers to the equipment of USB interface if mouse, keyboard, printer, scanner, camera, flash disk, MP3 machine, mobile phone, digital camera, portable hard drive, external smooth floppy drive, USB network interface card, ADSL Modem, Cable Modem etc. are with the various external units of USB interface.The advantages such as to have transmission speed fast, easy to use due to USB interface, supports hot plug, connects flexibly, independently-powered, this type of device category is more and more.In the logical organization of USB device, comprise equipment, configuration, interface and 4 levels of end points.Each USB device can comprise one or more sets configurations, and different configurations makes equipment list reveal different function combinations, and at synchronization, equipment can only use a set of configuration.A set of configuration can be made up of one or more logic interfacing, and in usb protocol, a logic interfacing represents a basic function, and the equipment with multiple logic interfacings is called USB equipment complex.
USB device all needs to provide corresponding driver in use conventionally, it is mainly to provide drive installation CD with equipment that USB device producer provides the approach of driver, but increased like this cost of producer, the careless scratching of CD or loss simultaneously more can cause equipment under new environment, to use.For above-mentioned deficiency, in prior art, be in USB device, to divide one section of storage area to carry out storing driver installation procedure, USB device on original basis more adds a logic interfacing and on main frame, this interface is exposed into a virtual drive interface, the region of that section of storing driver installation procedure is exposed to host computer with this interface, and that section of storage area is just shown as virtual drive in host computer.This method has been added a logic interfacing more makes USB device must become USB equipment complex, first when interventional instrument, because the driving of USB equipment complex is not yet installed, Windows operating system will eject the warning that can not find device drives, and domestic consumer sees that these information will inevitably be all adrift.
Summary of the invention
The object of the invention is, in order to make USB device can not eject the warning that can not find device drives in Windows operating system, to have proposed a kind of recognition methods of the USB device with virtual drive.
To achieve these goals, technical scheme provided by the invention is: 1. the recognition methods of the USB device with virtual drive, it is characterized in that, and when USB device is inserted host computer, the treatment scheme of USB device comprises step:
A.USB equipment carries out various initialization operations;
B., flag is set, a flag is set in the storer of USB device, and make this flag there is two states, state one represents that the driving of USB device do not install, state two represents that the driving of USB device installs, and in the time that USB device is connected with host computer and starts first, the flag of USB device is initialized as state one, and make this flag after start-up course in can not be initialised again, and its address space also can not taken by other program;
C.USB device start also judges the state of storer flag, when flag be state for the moment, start single interface configuration, USB device exposes as USB virtual drive; In the time that flag is state two, start many interface configuration, USB device exposes as USB equipment complex;
What D.USB device processes host computer was sent obtains character string descriptor request, and judge whether a upper request is the request that configuration is set, if a upper request is that the flag arranging in request and the storer of configuration is state one, the flag of storer is made as to state two and USB device is restarted and turn back to step C; Otherwise, be that the flag arranging in request and the storer of configuration is under two conditions of state one if can not meet a upper request simultaneously, continue to judge the state of storer flag and enter respectively step e or step F according to the state of zone bit;
If E. in step D, flag is state one, carry out the operation of USB virtual drive backward, USB equipment complex driver is installed, and drive installation program can be revised as USBCCGP from USBSTOR by the service entry of registering in registration table for USB device in Windows operating system;
If F. in step D, flag is state two, carry out the operation of USB equipment complex backward, carry out the functional performance of various USB equipment complexes.
Principle of the present invention is to allow USB device initialization two cover configurations in the time starting, and a set of configuration only provides single interface configuration of a virtual drive interface, and a set of configuration provides and comprises the many interface configuration of virtual drive interface in interior multiple logic interfacings in addition.When USB device starts for the first time, always select single interface configuration, after starting with this configuration, judge the whether erecting equipment driving of Windows operating system of host computer, install if driven, restarting equipment, and select to start many interface configuration.Otherwise do not restart, continue to carry out the driving that USB equipment complex is installed in virtual drive operation backward.
The invention has the beneficial effects as follows: utilize above-mentioned principle and method, no matter the driving of in the Windows operating system of host computer, whether the USB equipment complex of many interfaces being installed, after USB device is inserted main frame, Windows operating system can not eject the warning that can not find device drives.
Accompanying drawing explanation
Fig. 1 is the processing flow chart of the USB device of the embodiment of the present invention.
Fig. 2 is the Windows operating system processing flow chart of the embodiment of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
In the present embodiment, host computer is selected conventional standard configuration in prior art, and operating system can be selected the WinXp of Windows operating system, Vista, the versions such as Win7.In the time that USB device is exposed as single interface, host computer can think that USB device is now a USB virtual drive, host computer is that USB device loads standard driver usbstor.sys by Windwos operating system, if this equipment is not also registered driver service entry in registration table again, Windows operating system can be also USB device registration service item USBSTOR in registration table; In the time that USB device is exposed as many interfaces, host computer can think that USB device is now USB equipment complex, host computer is that USB device loads USB equipment complex driver usbccgp.sys by Windwos operating system, if this equipment is not also registered driver service entry in registration table again, Windows operating system can be also USB device registration service item USBCCGP in registration table.As shown in Figure 1, a kind of recognition methods of the USB device with virtual drive, in the time that USB device is inserted host computer, the treatment scheme of USB device comprises step:
A.USB equipment carries out various initialization operations, and for example initializes memory can be used storer.
B., flag is set, a flag is set in the storer of USB device, and make this flag there is two states, state one represents that the driving of USB device do not install, state two represents that the driving of USB device installs, and in the time that USB device is connected with host computer and starts first, the flag of USB device is initialized as state one, and make this flag after start-up course in can not be initialised again, and its address space also can not taken by other program.Null representation state one for the present embodiment, non-zero identification-state two, in the time that USB device is connected with host computer and starts first, it is zero that the flag of USB device is initialized as state one, can be again to this flag initialization in start-up course afterwards, and the address space of this flag also can not taken by other program.State one in this step and the concrete numerical value of state two also can be exchanged.
C.USB device start also judges the state of storer flag, when flag be state for the moment, start single interface configuration, USB device exposes as USB virtual drive; In the time that flag is state two, start many interface configuration, USB device exposes as USB equipment complex;
What D.USB device processes host computer was sent obtains character string descriptor request, and judge whether a upper request is the request that configuration is set, if and flag in storer is state one, the flag of storer is made as to state two and USB device is restarted; Otherwise continuation judges the state of storer flag.
If E. in step D, flag is state one, carry out the operation of USB virtual drive backward, USB equipment complex driver is installed, and drive installation program can be revised as USBCCGP from USBSTOR by the service entry of registering in registration table for USB device in Windows operating system.In this step, carry out virtual drive operation is the driving that USB equipment complex is installed in the operation of simulation CD-ROM drive backward, after installation, USB device restarts, now, the mode restarting has two kinds, one is again to insert after user pulls out USB device, obviously, this mode is not very desirable, two kinds is that drive installation program is sent out message to USB device and allowed equipment restart, this reboot operation is exactly transparent to user, owing to now only having exposed USB virtual drive interface to host computer, so the driver of host computer can only send message to USB device by described single interface, annunciator drives and installs.
If F. in step D, flag is state two, carry out the operation of USB equipment complex backward, carry out the functional performance of various USB equipment complexes.The functional performance being undertaken by manually realizing the various functional application of USB equipment complex after carrying out drive installation that USB equipment complex operation refers to USB device in this step backward and completing and after restarting.
In the time that USB device is inserted host computer, host computer detects USB device, and corresponding to the treatment scheme of above-mentioned USB device, as shown in Figure 2, the treatment scheme of the Windows operating system of host computer comprises step:
A. host computer is USB device load driver by Windows operating system, in the time of USB device and host computer first connection due to the driver usbccgp.sys of USB equipment complex not being installed, load standard driver usbstor.sys so operating system is USB device, Windows operating system can the appropriate location in registration table be the registration entries that USB device is added service USBSTOR by name simultaneously; Otherwise, when the driver usbccgp.sys of USB equipment complex is installed, because the Service name USBSTOR of the registration entries in USB device registration table has now been USBCCGP by drive installation modification of program, operating system can be that USB device loads USB equipment complex driver usbccgp.sys.Like this, after USB device is restarted, Windows can be USBSTOR or USBCCGP according to the Service name of registration entries, decides loading standard driver usbstor.sys or USB equipment complex driver usbccgp.sys.
If that b. host computer is that USB device loads is standard driver usbstor.sys but not USB equipment complex driver usbccgp.sys, host computer directly sends the request of obtaining character string descriptor to USB device; Otherwise host computer first sends the request that configuration is set to USB device, and then send the request of obtaining character string descriptor to USB device.
The present embodiment judge whether the Windows operating system of host computer installed that USB equipment complex drives according to as described below: no matter select single interface configuration or many interface configuration when device start, on host computer, only may attempt mating two drivers into equipment:
1. in the time that USB device exposes as single interface configuration to host computer, host computer can think that equipment is a USB virtual drive, is then device loads standard driver usbstor.sys.If USB device is to insert for the first time host computer, Windows operating system also can be added the registration entries of service USBSTOR by name in registration table.
2. in the time that USB device exposes many interface configuration to host computer, host computer can think that equipment is a USB equipment complex, is then device loads USB equipment complex driver usbccgp.sys.When USB device is installed USB equipment complex driver usbccgp.sys first, drive installation program can be revised as USBCCGP from USBSTOR by service entry in registration table.
In the time that host computer loads these two drivings, the command sequence that these two drivers are dealt into USB device is different, first usbstor.sys can send out an order of obtaining character string descriptor to equipment, and first usbccgp.sys can send out an order that USB configuration is set to equipment, and then send out an order of obtaining character string descriptor to equipment, utilize this point difference, USB device just can judge to drive whether install on main frame.
Again describe implementation process of the present invention in conjunction with Fig. 1 and Fig. 2 in detail in conjunction with an embodiment below.
Suppose that USB device inserts in a host computer that USB equipment complex driver usbccgp.sys is not installed, USB device is through initialization operation and arranging after flag, USB device starts for the first time, now flag is zero, thereby start single interface configuration, what processing host was sent obtains character string descriptor request.Simultaneously, the registration entries that Windows operating system loads standard driver usbstor.sys and add service USBSTOR by name for USB device in registration table, now, do not send the request that configuration is set and directly send the request of obtaining character string descriptor to equipment to equipment.Enter after next determining step, owing to now not meeting " upper one that obtains character string descriptor request is configuring request to be set and storer flag is 0 " this condition, enter again judgement next time, because storer flag is now 0, thereby carry out USB virtual drive operation backward, USB equipment complex driver usbccgp.sys is installed, and meanwhile, drive installation program is revised as USBCCGP by the Service name of the registration entries in registration table by USBSTOR.
USB device starts for the second time by artificial or automated manner, and now flag is still zero, thereby starts single interface configuration, and what processing host was sent obtains character string descriptor request.Simultaneously, because the Service name of the registration entries of USB device in registration table is revised as and is automatically revised as USBCCGP by USBSTOR, Windows operating system loads USB equipment complex driver usbccgp.sys, thereby Windows operating system can first send then the request of configuration the obtains character string descriptor request in transmission that arranges.Enter after next determining step, owing to now meeting " upper one that obtains character string descriptor request is configuring request to be set and storer flag is 0 " this condition, thereby USB device is made as storer flag non-zero.USB device starts for the third time by artificial or automated manner, and now flag is non-zero, thereby starts many interface configuration, and what processing host was sent obtains character string descriptor request.Simultaneously, because the Service name of the registration entries of USB device in registration table is USBCCGP, Windows operating system loads USB equipment complex driver usbccgp.sys, thereby Windows operating system can first send then the request of configuration the obtains character string descriptor request in transmission that arranges.Enter after next determining step, owing to now not meeting " upper one that obtains character string descriptor request is configuring request to be set and storer flag is 0 " this condition, enter again next time judgement, because storer flag is now 1, thereby carry out the operation of USB equipment complex backward.
After above-mentioned three artificial or autoboots, the driver of USB equipment complex is with regard to normal mounting, no matter restart afterwards how many times, Windows operating system all loads USB device USB equipment complex driver usbccgp.sys automatically, carries out the operation of USB equipment complex.
Those of ordinary skill in the art will appreciate that, embodiment described here is in order to help reader understanding's principle of the present invention, should be understood to that protection scope of the present invention is not limited to such special statement and embodiment.Those of ordinary skill in the art can make various other various concrete distortion and combinations that do not depart from essence of the present invention according to these technology enlightenments disclosed by the invention, and these distortion and combination are still in protection scope of the present invention.

Claims (1)

1. a recognition methods for the USB device with virtual drive, is characterized in that, when USB device is inserted host computer, the treatment scheme of USB device comprises step:
A.USB equipment carries out various initialization operations;
B., flag is set, a flag is set in the storer of USB device, and make this flag there is two states, state one represents that the driving of USB device do not install, state two represents that the driving of USB device installs, and in the time that USB device is connected with host computer and starts first, the flag of USB device is initialized as state one, and make this flag after start-up course in can not be initialised again, and its address space also can not taken by other program;
C.USB device start also judges the state of storer flag, when flag be state for the moment, start single interface configuration, USB device exposes as USB virtual drive; In the time that flag is state two, start many interface configuration, USB device exposes as USB equipment complex;
What D.USB device processes host computer was sent obtains character string descriptor request, and judge whether a upper request is the request that configuration is set, if a upper request is that the flag arranging in request and the storer of configuration is state one, the flag of storer is made as to state two and USB device is restarted and turn back to step C; Otherwise, be that the flag arranging in request and the storer of configuration is under two conditions of state one if can not meet a upper request simultaneously, continue to judge the state of storer flag and enter respectively step e or step F according to the state of zone bit;
If E. in step D, flag is state one, carry out the operation of USB virtual drive backward, USB equipment complex driver is installed, and drive installation program can be revised as USBCCGP from USBSTOR by the service entry of registering in registration table for USB device in Windows operating system;
If F. in step D, flag is state two, carry out the operation of USB equipment complex backward, carry out the functional performance of various USB equipment complexes.
CN201010162529.5A 2010-05-05 2010-05-05 Identification method of USB device with virtual drive Expired - Fee Related CN101853142B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010162529.5A CN101853142B (en) 2010-05-05 2010-05-05 Identification method of USB device with virtual drive

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010162529.5A CN101853142B (en) 2010-05-05 2010-05-05 Identification method of USB device with virtual drive

Publications (2)

Publication Number Publication Date
CN101853142A CN101853142A (en) 2010-10-06
CN101853142B true CN101853142B (en) 2014-06-04

Family

ID=42804655

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010162529.5A Expired - Fee Related CN101853142B (en) 2010-05-05 2010-05-05 Identification method of USB device with virtual drive

Country Status (1)

Country Link
CN (1) CN101853142B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103555A (en) * 2011-01-30 2011-06-22 中兴通讯股份有限公司 Method and system for switching ports of USB (universal serial bus) device
US11258676B2 (en) 2011-09-14 2022-02-22 Barco N.V. Electronic tool and methods for meetings
CN102375786B (en) * 2011-10-18 2014-09-10 中兴通讯股份有限公司 Automatic operating system identifying method and system for USB (Universal Serial Bus) equipment
CN102902518B (en) 2012-08-17 2017-06-06 中兴通讯股份有限公司 A kind of changing method of active USB device and its mode of operation
CN105094880A (en) * 2014-05-23 2015-11-25 中兴通讯股份有限公司 USB driving method, computer and compound equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620538A (en) * 2008-07-01 2010-01-06 希姆通信息技术(上海)有限公司 Method for automatically operating CDROM function on USB network card equipment
CN101650694A (en) * 2009-08-21 2010-02-17 深圳华为通信技术有限公司 USB device, computer and method for achieving virtual device allocation of USB device
CN101694641A (en) * 2009-09-28 2010-04-14 北京深思洛克软件技术股份有限公司 Method and system for initializing universal serial bus (USB) devices

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101620538A (en) * 2008-07-01 2010-01-06 希姆通信息技术(上海)有限公司 Method for automatically operating CDROM function on USB network card equipment
CN101650694A (en) * 2009-08-21 2010-02-17 深圳华为通信技术有限公司 USB device, computer and method for achieving virtual device allocation of USB device
CN101694641A (en) * 2009-09-28 2010-04-14 北京深思洛克软件技术股份有限公司 Method and system for initializing universal serial bus (USB) devices

Also Published As

Publication number Publication date
CN101853142A (en) 2010-10-06

Similar Documents

Publication Publication Date Title
US8028155B1 (en) Initiating an operating system boot from firmware
US8296521B2 (en) Method of configuring non-volatile memory for a hybrid disk drive
US8650332B2 (en) Method for switching working mode, USB device, and host device
CN100365576C (en) Memory mirror starting optimization of built-in operation system
CN101853142B (en) Identification method of USB device with virtual drive
CN101609408B (en) A kind of method and system realizing self-start of terminal equipment
CN109426613B (en) Method for retrieving debugging data in UEFI and computer system thereof
CN109324991B (en) Hot plug device, method, medium and system of PCIE (peripheral component interface express) equipment
CN104679540A (en) Computer system and computer system starting method
CN109002346B (en) Conversion method of Windows virtual machine bootstrap program
US8677084B2 (en) Method of configuring non-volatile memory for a hybrid disk drive
CN112486522A (en) Deployment method and device of OpenStack bare machine with intelligent network card
CN109426527B (en) Computer system and method for sharing Bluetooth data between UEFI firmware and operating system
CN102073524B (en) A kind of method of wireless communication terminal and self-starting thereof
CN104407890A (en) Method for starting Android system from OTG (On-The-Go) equipment
CN113608790A (en) Linux system based self-adaptive management method and system for serial device and storage medium
CN116737244A (en) Method and device for starting multiple hardware domains of chip
US9465597B2 (en) System for operating a device as a storage device and a modem device
US10616944B2 (en) Computer system and method thereof for sharing of wireless connection information between UEFI firmware and OS
CN114816491A (en) System upgrading method and device for multi-system mobile terminal and terminal
EP2835737A1 (en) Data terminal running mode switching method, device, and data terminal
CN102591691B (en) Hard disk startup method and the os starting loading method based on BIOS
CN116450046A (en) Cloud disk implementation method and device, intelligent network card, server and storage medium
CN103176832A (en) Method of similar UNIX operation system running virtual operation system and device of similar UNIX operation system running virtual operation system
CN108052337A (en) A kind of firmware upgrade method and device of eMMC production tools

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20140604

Termination date: 20170505

CF01 Termination of patent right due to non-payment of annual fee