Summary of the invention
In view of in prior art, due to needing before debugging USB device, traversal is carried out to the information of USB device and is led
One of the technical issues of slow-footed problem of disk on cause USB device, the embodiment of the present application is solved, is to provide a kind of debugging USB
The method of equipment does not depend on the difference of USB device itself while disk speed on improving USB device.
In a first aspect, the embodiment of the present application provides a kind of upper disk configuration method of USB device, comprising:
Host supervision is to after there is USB device connection, the registration table of scanning system;
Judge the registration table whether include the USB device sequence number, PID and VID information;
When sequence number of the registration table not comprising the USB device, PID and VID information, the host will be according to institute
State the sequence number that the USB HUB of USB device institute carry is generated, PID and VID information injects the registration table, and to the USB
HUB sends USB command;
When sequence number of the registration table comprising the USB device, PID and VID information, described in the host calling
The driving of USB device.
Optionally, the host supervision to have USB device connection before include:
When the state of the host computer polls to the USB HUB, which is, USB device connection, USB device company has been monitored
It connects.
Optionally, described to include: to USB HUB transmission USB command
After the USB HUB receives the USB command that the host is sent, judge whether the USB command is to obtain USB to set
Standby sequence number, the order of PID and VID information;
If so, returning to the sequence according to the ID of the E2ROM of the USB HUB USB device generated to the host
Row number, PID and VID information;
If it is not, the USB command is then sent to USB device corresponding with the USB command, by described corresponding
USB device returns to data corresponding with the USB command.
Optionally, described that the USB device generated according to the ID of the E2ROM of the USB HUB is returned to the host
Sequence number, include: after PID and VID information
The host receives the sequence number for the USB device that the USB HUB is returned, after PID and VID information, and
The sequence number of the USB device of the registration table, PID and VID information comparison, if the institute that the USBHUB received is returned
State the sequence number of USB device, the sequence number of PID and VID information and the USB device of the registration table, PID and VID information
Unanimously, then the driving of the USB device is called.
Second aspect, the embodiment of the present application also provides a kind of hosts, comprising: scan module, judgment module and processing mould
Block, in which:
Scan module is connected with the judgment module, for host supervision to after there is USB device connection, scanning system
Registration table, and the scanning result of the registration table is sent to the judgment module;
Judgment module is connected with the scan module and the processing module, for according to the scanning mould received
Block send scanning result, judge the registration table whether include the USB device sequence number, PID and VID information;
Processing module is connected with the judgment module, for when the registration table for receiving the judgment module transmission
Sequence number not comprising the USB device will be according to the USB device institute carry when judging result of PID and VID information
The sequence number that USB HUB is generated, PID and VID information injects the registration table, and sends USB command to the USB HUB, and
When receiving the sequence number that the registration table that the judgment module is sent includes the USB device, PID and VID information is sentenced
When disconnected result, the driving of the USB device is called.
Optionally, the host further includes monitoring modular, and the monitoring modular is connected with the scan module, is used for: when
The state of the host computer polls to the USB HUB are when having USB device connection, and the monitoring modular determination monitors the master
Machine has USB device connection, and monitoring result is sent to the scan module.
Optionally, the processing module includes: to USB HUB transmission USB command
After the USB command that the processing module that the USB HUB receives the host is sent, whether the USB command is judged
It is the sequence number for obtaining USB device, the order of PID and VID information;
If so, the USB HUB is returned according to the ID of the E2ROM of USB HUB generation to the host
The sequence number of USB device, PID and VID information;
If it is not, then the USB command is sent to USB device corresponding with the USB command by the USB HUB, with by
The corresponding USB device returns to data corresponding with the USB command.
Optionally, the USB HUB is returned according to the ID of the E2ROM of USB HUB generation to the host
The sequence number of USB device, PID and VID information include: later
The processing module of the host receives the sequence number for the USB device that the USB HUB is returned, PID and VID
After information and the sequence number of the USB device of the registration table, PID and VID information comparison;
If the sequence number for the USB device that the USBHUB received is returned, PID and VID information and the registration
The sequence number of the USB device of table, PID and VID information is consistent, then calls the driving of the USB device.
By above technical scheme as it can be seen that the embodiment of the present application can while disk speed on improving extensive USB device,
The difference of USB device itself is not depended on yet.
Specific embodiment
In order to make those skilled in the art more fully understand the technical solution in the embodiment of the present application, below in conjunction with the application
Attached drawing in embodiment, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that described reality
Applying example only is the embodiment of the present application a part of the embodiment, instead of all the embodiments.Based on the implementation in the embodiment of the present application
The range of the embodiment of the present application protection all should belong in example, those of ordinary skill in the art's every other embodiment obtained.
Based on when large scale test USB device, usually a host passes through USB HUB connection 32 even in prior art
64 USB devices, and in the USB device of these quantity upper disk for the first time, host need to traverse the description of all USB devices
Symbol, the information such as sequence number could load the driving of USB device, and then test software is completed in the drive load of whole USB devices
Afterwards, USB device could be tested, leads to the slow-footed problem of upper disk of USB device, the embodiment of the present application provides one kind
The upper disk configuration method of USB device and a kind of host, to solve the problems, such as USB device, upper disk is slow-footed for the first time.
Referring to Fig. 1, the embodiment of the present application provides a kind of upper disk configuration method of USB device, comprising:
S100: host supervision is to after there is USB device connection, the registration table of scanning system.
Host supervision is to after there is USB device connection, the registration table of scanning system first, according to the scanning knot of registration table
Fruit checks that, with the presence or absence of the sequence number for the USB device being connected on the host in registration table, PID and VID information executes step
Rapid S200.
S200: judge registration table whether include USB device sequence number, PID and VID information.
Host executes step S300 or S400 according to the judging result of step S200.
S300: when sequence number of the registration table not comprising USB device, PID and VID information, host will be according to USB device institute
The sequence number that the USB HUB of carry is generated, PID and VID information injects registration table, and sends USB command to USB HUB.
S400: when sequence number of the registration table comprising USB device, PID and VID information, host calls the drive of USB device
It is dynamic.
In view of in USB device upper disk for the first time, host needs to be traversed for the sequence for all USB equipment being connected thereto
Row number after PID and VID information, reloads the driving of USB device, causes disk speed on USB slow, and when USB device is in host
In the case where crossing disk out, when being connected on host, there is no need to traverse the sequence number for all USB devices being connected thereto,
PID and VID information, but original driving is called directly, in order to solve the problems, such as USB device, upper disk is slow-footed for the first time, this
Apply for that embodiment, will be according to USB device institute by host in sequence number of the registration table not comprising USB device, PID and VID information
The sequence number that the USB HUB of carry is generated, after PID and VID information is previously implanted registration table, to the USB of USB device institute carry
HUB sends USB command.Certainly, in the case where registration table includes sequence number PID and the VID information of USB device, host is direct
The driving for calling USB original.
It should be noted that USB HUB is used to monitor being connected and disconnected from for USB device, and IN endpoint is interrupted using it
(Interrupt IN Endpoint) is to the connection of host report USB device.In system starting, host passes through poll
The state of root HUB (Root HUB) sees if there is USB device connection.I.e. host supervision to have USB device connection before include:
When the state of host computer polls to USB HUB, which is, USB device connection, monitor that USB equipment connects.That is, main
Machine determines whether that USB is set by the USB device connection status of poll USB HUB by USB HUB connection USB device
It is standby to be connected to itself.
In the embodiment of the present application, it when host learns new USB device connection, sends USB command and is hung to USB device
After USB HUB, the USB HUB of load receive the USB command of host transmission, judge whether USB command is the sequence for obtaining USB device
Row number, the order of PID and VID information;If so, returning to the USB device generated according to the ID of the E2ROM of USB HUB to host
Sequence number, PID and VID information;If it is not, USB command is then sent to corresponding USB device, to be returned by corresponding USB device
Return data corresponding with the USB command.
When host receives the sequence number of the USB device of USB HUB return, after PID and VID information and system note itself
The sequence number of the USB device of volume table, PID and VID information are compared, if receiving the sequence of the USB device of USB HUB return
Number, PID and VID information is consistent, then calls directly the driving of USB device.
Every level-one USB HUB chip for testing every piece of test board of USB device has E2ROM, and E2ROM has only
One ID after the completion of the USB HUB initialization on test board, first reads out the ID of E2ROM, according to the ID of reading after the power-up
The sequence number that the port USB HUB is reported to host is generated, then by sequence number and the USB
In the embodiment of the present application, host is in advance the sequence of the USB device generated of the ID according to the E2ROM of USB HUB
Number, PID and VID information is injected into system registry, and is obtained when host is sent to the USB HUB of USB equipment institute carry
The sequence number of USB device, after the USB command of PID and VID information, what USB HUB was returned to host is also according to USB HUB's
The sequence number for the USB device that the ID of E2ROM is generated, and the sequence number of USB device, PID and VID information are according to identical
What rule generated, therefore work as the sequence number that host receives the USB device of USB HUB return, after PID and VID information, and itself
The sequence number of the USB device of system registry when PID and VID information is compared, will obtain the knot that USB device went out disk
By, so that the true sequence number of USB device is no longer traversed, and PID and VID information, the disk speed on improving extensive USB device
While, do not depend on the difference of USB device itself yet.
As shown in Fig. 2, being based on same inventive concept, the embodiment of the present application also provides a kind of hosts 20, including scanning
Module 210, judgment module 220 and processing module 230, in which:
Scan module 210 and judgment module 220 connect, for host supervision to after there is USB device connection, scanning system
Registration table, and the scanning result of registration table is sent to judgment module 220;
Judgment module 220 and scan module 210 are that processing module 230 connects, for according to the scan module hair received
The scanning result sent, judge registration table whether include USB device sequence number, PID and VID information;
Processing module 230 and judgment module 220 connect, for not wrapping when the registration table for receiving the transmission of judgment module 220
Sequence number containing USB device, when the judging result of PID and VID information, by what is generated according to the USB HUB of USB device institute carry
Sequence number, PID and VID information injects registration table, and sends USB command to USB HUB, and send out when receiving judgment module 220
The registration table sent includes the sequence number of USB device, when the judging result of PID and VID information, calls the driving of USB device.
In one exemplary embodiment, host 20 further includes the monitoring modular 200 being connected with scan module 210, is used for:
When the state that host 20 is polled to USB HUB is to have USB device connection, the determination of monitoring modular 200 monitors to lead
Machine 20 has USB device connection, and monitoring result is sent to scan module 210.
In one exemplary embodiment, processing module 230 includes: to USB HUB transmission USB command
After the USB command that the processing module 230 of USB HUB receiving host 20 is sent, judge whether USB command is to obtain
The sequence number of USB device, the order of PID and VID information;
If so, USB HUB returns to the sequence according to the ID of the E2ROM of the USB HUB USB device generated to host 20
Number, PID and VID information;
If it is not, then USB command is sent to USB device corresponding with USB command by USB HUB, by corresponding USB device
Return to data corresponding with USB command.
In one exemplary embodiment, USB HUB is generated to the return of host 20 according to the ID of the E2ROM of USB HUB
The sequence number of USB device, PID and VID information include: later
The processing module 230 of host receives the sequence number of the USB device of USB HUB return, after PID and VID information,
With the sequence number of the USB device of registration table, PID and VID information comparison;
If the sequence number for the USB device that the USB HUB received is returned, the USB device of PID and VID information and registration table
Sequence number, PID and VID information is consistent, then calls the driving of USB device.
The scan module 210 of above-mentioned host 20, judgment module 220 and processing module 230 are for executing USB device
Upper disk configuration method.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in detail or remembers in some embodiment
The part of load, reference can be made to the related descriptions of other embodiments.
Those of ordinary skill in the art may be aware that function described in conjunction with the examples disclosed in the embodiments of the present disclosure
Can module and method and step, can be realized with the combination of electronic hardware or computer software and electronic hardware.These functions
It is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Professional technique
Personnel can specifically realize described function to each using distinct methods, but this realization is it is not considered that super
The scope of the present invention out.
In embodiment provided by the present invention, it should be understood that disclosed device and method can pass through others
Mode is realized.For example, the apparatus embodiments described above are merely exemplary, for example, the division of above-mentioned module or unit,
Only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components can be with
In conjunction with or be desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed
Mutual coupling or direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING of device or unit or
Communication connection can be electrical property, mechanical or other forms.
Above-mentioned unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
If above-mentioned integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, the present invention realizes above-described embodiment side
All or part of the process in method can also instruct relevant hardware to complete, above-mentioned computer by computer program
Program can be stored in a computer readable storage medium, and the computer program is when being executed by processor, it can be achieved that above-mentioned each
The step of a embodiment of the method.Wherein, above-mentioned computer program includes computer program code, and above-mentioned computer program code can
Think source code form, object identification code form, executable file or certain intermediate forms etc..Above-mentioned computer readable storage medium
It may include: any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic that can carry above-mentioned computer program code
Dish, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM,
Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that above-mentioned
It is appropriate that the content that computer readable storage medium includes can be carried out according to the requirement made laws in jurisdiction with patent practice
Increase and decrease, such as do not include electric carrier wave according to legislation and patent practice, computer readable storage medium in certain jurisdictions
Signal and telecommunication signal.
Above-described embodiment is merely illustrative of the technical solution of the present invention, rather than its limitations.Although the application has been described
The preferred embodiment of embodiment, but one of ordinary skilled in the art once knows basic creative concept, then it can be to this
A little embodiments make other change and modification.So the following claims are intended to be interpreted as including preferred embodiment and falls
Enter all change and modification of the embodiment of the present application range.Obviously, those skilled in the art can to the embodiment of the present application into
Spirit and scope of the various modification and variations of row without departing from the embodiment of the present application.If in this way, these of the embodiment of the present application
Modifications and variations belong within the scope of the embodiment of the present application claim and its equivalent technologies, then the embodiment of the present application is also intended to
It includes these modifications and variations.