CN103440214A - Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment - Google Patents

Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment Download PDF

Info

Publication number
CN103440214A
CN103440214A CN2013103955344A CN201310395534A CN103440214A CN 103440214 A CN103440214 A CN 103440214A CN 2013103955344 A CN2013103955344 A CN 2013103955344A CN 201310395534 A CN201310395534 A CN 201310395534A CN 103440214 A CN103440214 A CN 103440214A
Authority
CN
China
Prior art keywords
usb
path
plugged
operating system
usb port
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.)
Granted
Application number
CN2013103955344A
Other languages
Chinese (zh)
Other versions
CN103440214B (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.)
Shenzhen Rapoo Technology Co Ltd
Original Assignee
Shenzhen Rapoo Technology 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 Shenzhen Rapoo Technology Co Ltd filed Critical Shenzhen Rapoo Technology Co Ltd
Priority to CN201310395534.4A priority Critical patent/CN103440214B/en
Publication of CN103440214A publication Critical patent/CN103440214A/en
Application granted granted Critical
Publication of CN103440214B publication Critical patent/CN103440214B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Systems (AREA)

Abstract

The invention discloses a method and a device for rapidly identifying plugged USB (Universal Serial Bus) equipment. The method comprises the following steps of: recording an equipment path correspondingly generated in an operating system when each type of target USB equipment is plugged into different USB ports, information of one equipment path and one USB port and information of one type of the target USB equipment; periodically opening the recorded equipment path according to pre-set time so as to identify the target USB equipment plugged on the USB port. According to the method disclosed by the invention, the equipment paths correspondingly generated in the operating system when the each type of target USB equipment is plugged into the different USB ports are recorded in advance and the recorded equipment paths are opened at stated times, so that the identification time of the plugged target USB equipment by the operating system is shortened.

Description

A kind of method and device of quick identification grafting USB device
Technical field
The present invention relates to the USB device detection field, relate in particular to a kind of method and device of quick identification grafting USB device.
Background technology
Usually, for guaranteeing the correctness of product function, PC periphery product (such as keyboard, mouse, game paddle etc.) generally all needs to carry out the product detection when producing, and PC periphery product major part all is based on the equipment of USB interface, generally all product to be inserted into to the USB port on PC while therefore detecting, the testing software of installing in PC again carries out the product detection, and PC will directly have influence on production efficiency to the recognition speed of USB device.
According to statistics, pre-installed the PC of Windows operating system, difference according to the actual conditions of PC hardware configuration, Windows XP operating system is approximately 2~5 seconds to the recognition time of USB device plug, this time can be accepted fully concerning domestic consumer, but, for factory work, prior art Windows XP operating system is oversize to the recognition time of the USB device of grafting, has restricted factory work efficiency.
Therefore, prior art need to improve.
Summary of the invention
The object of the present invention is to provide a kind of method of quick identification grafting USB device, shortened the recognition time of operating system to the USB device of grafting.
For reaching this purpose, the present invention by the following technical solutions:
One aspect of the present invention provides a kind of method of quick identification grafting USB device, comprising:
When recording every an article or item in a contract mark USB device and being plugged on different USB port in operating system the corresponding device path generated, the information of a device path and a USB port, the information of a target USB device;
Open the device path of record according to default time cycle property, to identify the target USB device that is plugged on USB port.
Wherein, described when recording every an article or item in a contract mark USB device and being plugged on different USB port in operating system the corresponding device path generated, comprising:
Detect respectively each USB port and whether be plugged with the target USB device;
If a certain USB port is plugged with the target USB device, in operating system, generate should USB port and a device path of this target USB device;
The device path that record generates respectively.
Wherein, if described a certain USB port is plugged with the target USB device, in operating system, generate to should USB port and a device path of this target USB device after, also comprise:
Described device path is set as to the pre-file reading of operating system.
Wherein, the described device path of opening record according to default time cycle property comprises:
A timer is set, and this timer is according to default time cycle property timing;
When at timer, the default time arrives, in the call operation system, the function of file reading is opened the device path of record.
Wherein, described operating system is Windows operating system;
In described call operation system, the function of file reading is opened the device path of record, is specially:
Call createfile function in Windows operating system and open the device path of record, simultaneously the current target USB device list that is plugged into USB port of control operation system refresh.
Wherein, the described default time is 100~500 milliseconds.
The present invention also provides a kind of device of quick identification grafting USB device on the other hand, comprising:
The path logging modle, the device path generated in the operating system correspondence while for recording every an article or item in a contract mark USB device, being plugged on different USB port, the information of a device path and a USB port, the information of a target USB device;
Module is opened in path, for the device path of opening record of the time cycle property according to default, to identify the target USB device that is plugged on USB port.
Wherein:
Described path logging modle, specifically for, detect respectively each USB port and whether be plugged with the target USB device; If a certain USB port is plugged with the target USB device, generate to should USB port and a device path of this target USB device the information of the information that described device path comprises this USB port, this target USB device in operating system; The device path that record generates respectively;
Module is opened in described path, specifically for, a timer is set, this timer is according to default time cycle property timing; When at timer, the default time arrives, in the call operation system, the function of file reading is opened the device path of record, to identify the target USB device that is plugged on USB port.
Wherein:
Described path logging modle, also for being set as device path the pre-file reading of operating system;
Described operating system is Windows operating system;
Module is opened in described path, specifically also for, when default time arrives at timer, call the device path that createfile function in Windows operating system is opened record, the current target USB device list that is plugged into USB port of control operation system refresh simultaneously.
Wherein, the described default time is 100~500 milliseconds.
Implement the embodiment of the present invention, there is following beneficial effect:
The device path that when embodiment of the present invention is plugged on different USB port by pre-recorded target USB device, correspondence generates in operating system, the device path of record is reusable.Every function of call operation system is at regular intervals opened the device path (even when USB device also is not plugged on USB port) of record, and then identifies the corresponding target USB device that is plugged on corresponding USB port; Shortened the recognition time of operating system to the USB device of grafting by the present invention.
The accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present invention or technical scheme of the prior art, below will the accompanying drawing of required use in embodiment or description of the Prior Art be briefly described, apparently, the accompanying drawing the following describes is only some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain according to these accompanying drawings other accompanying drawing.
Fig. 1 is the process flow diagram of method first embodiment of a kind of quick identification grafting USB device of the present invention.
Fig. 2 is the process flow diagram of method second embodiment of a kind of quick identification grafting USB device of the present invention.
Fig. 3 is the structural representation of the device embodiment of a kind of quick identification grafting USB device of the present invention.
Embodiment
Below in conjunction with accompanying drawing of the present invention, technical scheme in the embodiment of the present invention is carried out to clear, complete description, obviously, described embodiment is only a part of embodiment of the present invention, rather than whole embodiment.Embodiment based in the present invention, the every other embodiment that those of ordinary skills obtain under the prerequisite of not making creative work, belong to the scope of protection of the invention.
Below in conjunction with accompanying drawing 1-accompanying drawing 2, the method for the quick identification grafting USB device that the embodiment of the present invention is provided describes in detail.
Refer to Fig. 1, Fig. 1 is the process flow diagram of an embodiment of the method for a kind of quick identification grafting USB device of the present invention, and the method specifically comprises the steps S1-S3.
Step S1, the device path that when pre-recorded every an article or item in a contract mark USB device is plugged on different USB port, correspondence generates in operating system, the information of a device path and a USB port, the information of a target USB device; Be the information of the device path information that includes corresponding USB port, corresponding a target USB device.
In the embodiment of the present invention, described target USB device is for needing the USB device detected, when same an article or item in a contract mark USB device is plugged on different USB port, to generate different device paths in operating system, when different an article or item in a contract mark USB device are plugged on same USB port, in operating system, also will generate different device paths; Therefore, a device path of the present embodiment, be corresponding with the combination of a target USB device and a USB port.
The different USB port that described different USB port is PC, the operating system that described operating system is this PC, include but not limited to Windows operating system.The present embodiment be take Windows operating system, and as example, the present invention will be described.
In Windows operating system, a typical device path should have following form USB#Vid_24ae& Pid_2002#6& 723e50& 0& 2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}.Wherein: field " Vid_24ae& Pid_2002 " represent the information of USB device, field " 6& 723e50& 0& 2 " and " { a5dcbf10-6530-11d2-901f-00c04fb951ed} " represent the information of USB port.
Because the VID/PID of the same a USB device of producing on production line must be the same, once this USB device, be plugged on the same USB port of PC like this, the device path that Windows operating system is distributed to this USB device must be the same.After device path is recorded, but this device path Reusability, while being plugged into corresponding USB port with a USB device, without regenerating device path next time.
Step S2, according to the device path of opening record of default time cycle property, to identify the target USB device that is plugged on USB port.
In the embodiment of the present invention, even when the target USB device also is not plugged on USB port, once, this operation will force operating system initiatively to remove to refresh the current list of devices that is plugged into USB port to the device path that also can open record every the function of default time call operation system.Preferably, the described default time is 100~500 milliseconds.
Because the device path of record is reusable, by periodically opening device path and then identifying the target USB device that is plugged on USB port, accelerated the recognition speed of the target USB device to pegging graft.
The method of the quick identification grafting USB device by the above embodiment of the present invention, by pre-recorded, the device path that when every an article or item in a contract mark USB device is plugged on different USB port, correspondence generates in operating system, then the device path of opening record every the function of default time call operation system once, thereby shortened the recognition time of the target USB device of the USB port to being plugged into PC, be conducive to improve the operating efficiency that factory is detected the target USB device.
For the more detailed method of explaining a kind of quick identification grafting USB device of the present invention, the present invention also provides a kind of process flow diagram of the second embodiment of method of quick identification grafting target USB device.The present embodiment is applied on the PC of Windows operating system, and this PC comprises a plurality of USB port.Refer to Fig. 2, comprise the steps S21-S27.
Step S21, after the initialization success, detect respectively each USB port.
Step S22, is USB port plugged with the target USB device? if, carry out next step, otherwise, step S21 returned to.
Step S23 generates a corresponding device path, the information of the information that this device path comprises this USB port, this target USB device in operating system.Record this device path.
If this PC comprises 4 USB port, same target USB device at most can corresponding 4 device paths in the operating system of this PC.
In the present embodiment, described device path can be set as to the pre-file reading of operating system, the opening speed in fast oil (gas) filling device path.Windows under the system disk of Windows operating system the Prefetch file be exactly the path of the pre-file reading of storage, the file that many PF of take are extension name is arranged in the Prefetch file, i.e. pre-file reading.
Step S24, arrange a timer, and this timer is according to default time cycle property timing.Entering dormancy waits for.
Step S25, does the default time of timer arrive? if, carry out next step, otherwise, re-execute this step.
Step S26, in the call operation system, the function of file reading is opened the device path of record.In Windows operating system, call the device path that createfile function in Windows operating system is opened record, simultaneously the current list of devices that is plugged into USB port of control operation system refresh.
Step S27, identify the target USB device that is plugged on USB port by list of devices.
Finish.
By above-described embodiment, when pre-recorded every an article or item in a contract mark USB device is plugged on different USB port in operating system the corresponding device path generated, but and device path record after Reusability; The device path of opening record every the function of default time call operation system again once, has shortened the recognition time of the target USB device of the USB port to being plugged into PC, has been conducive to improve the operating efficiency that factory is detected the target USB device.
Below the embodiment of the device that provides for the embodiment of the present invention.The embodiment of device and above-mentioned embodiment of the method belong to same design, and the detail content of detailed description not in the embodiment of device, can be with reference to said method embodiment.
Below in conjunction with accompanying drawing 3, the quick identification grafting USB device that the embodiment of the present invention is provided device describe in detail.It should be noted that, following apparatus can be applied to carry out said method.
Refer to Fig. 3, described device comprises: module 320 is opened in path logging modle 310, path.
Path logging modle 310, the device path generated in the operating system correspondence while for recording every an article or item in a contract mark USB device, being plugged on different USB port, the information of a device path and a USB port, the information of a target USB device.Specifically described with reference to above-described embodiment, do not repeat.
Module 320 is opened in path, for the device path of opening record of the time cycle property according to default, to identify the target USB device that is plugged on USB port.Specifically described with reference to above-described embodiment, do not repeat.
Preferably, wherein, described path logging modle 310, specifically for: at initial phase, detect respectively each USB port and whether be plugged with the target USB device; If USB port is plugged with the target USB device, generate a corresponding device path, the information of the information that described device path comprises this USB port, this target USB device in operating system; The device path that record generates respectively.Preferably, the logging modle of path described in the present embodiment 310 is set as described device path the pre-file reading of operating system.Specifically described with reference to above-described embodiment, do not repeat.
Module 320 is opened in described path, specifically for, a timer is set, this timer is according to default time cycle property timing; When at timer, the default time arrives, in the call operation system, the function of file reading is opened the device path of record, the current target USB device list that is plugged into USB port of control operation system refresh, identify the target USB device list that is plugged on USB port by the list of target USB device simultaneously.Specifically described with reference to above-described embodiment, do not repeat.
Wherein.The described default time is 100~500 milliseconds.
By implementing the above embodiment of the present invention, while by pre-recorded every an article or item in a contract mark USB device, being plugged on different USB port in operating system the corresponding device path generated, but and device path record after Reusability; The device path of opening record every the function of default time call operation system again once, has shortened the recognition time of the target USB device of the USB port to being plugged into PC, has been conducive to improve the operating efficiency that factory is detected the target USB device.
Above disclosed is only preferred embodiment of the present invention, certainly can not limit with this claim scope of the present invention, therefore, all any modifications of doing within the spirit and principles in the present invention, be equal to and replace and improvement etc., still belong to the scope that the present invention is contained.

Claims (10)

1. a method of identifying fast the grafting USB device, is characterized in that, comprising:
When recording every an article or item in a contract mark USB device and being plugged on different USB port in operating system the corresponding device path generated, the information of a device path and a USB port, the information of a target USB device;
Open the device path of record according to default time cycle property, to identify the target USB device that is plugged on USB port.
2. the method for quick identification grafting USB device according to claim 1, is characterized in that, described when recording every an article or item in a contract mark USB device and being plugged on different USB port in operating system the corresponding device path generated, comprising:
Detect respectively each USB port and whether be plugged with the target USB device;
If a certain USB port is plugged with the target USB device, in operating system, generate should USB port and a device path of this target USB device;
The device path that record generates respectively.
3. the method for quick identification grafting USB device according to claim 2, it is characterized in that, if described a certain USB port is plugged with the target USB device, in operating system, generate to should USB port and a device path of this target USB device after, also comprise:
Described device path is set as to the pre-file reading of operating system.
4. the method for quick identification grafting USB device according to claim 1, is characterized in that, the described device path of opening record according to default time cycle property comprises:
A timer is set, and this timer is according to default time cycle property timing;
When at timer, the default time arrives, in the call operation system, the function of file reading is opened the device path of record.
5. the method for quick identification grafting USB device according to claim 4, is characterized in that, described operating system is Windows operating system;
In described call operation system, the function of file reading is opened the device path of record, is specially:
Call createfile function in Windows operating system and open the device path of record, simultaneously the current target USB device list that is plugged into USB port of control operation system refresh.
6. the method for quick identification grafting USB device according to claim 1, is characterized in that, the described default time is 100~500 milliseconds.
7. a device of identifying fast the grafting USB device, is characterized in that, comprising:
The path logging modle, the device path generated in the operating system correspondence while for recording every an article or item in a contract mark USB device, being plugged on different USB port, the information of a device path and a USB port, the information of a target USB device;
Module is opened in path, for the device path of opening record of the time cycle property according to default, to identify the target USB device that is plugged on USB port.
8. device according to claim 7 is characterized in that:
Described path logging modle, specifically for, detect respectively each USB port and whether be plugged with the target USB device; If a certain USB port is plugged with the target USB device, generate to should USB port and a device path of this target USB device the information of the information that described device path comprises this USB port, this target USB device in operating system; The device path that record generates respectively;
Module is opened in described path, specifically for, a timer is set, this timer is according to default time cycle property timing; When at timer, the default time arrives, in the call operation system, the function of file reading is opened the device path of record, to identify the target USB device that is plugged on USB port.
9. device according to claim 8 is characterized in that:
Described path logging modle, also for being set as device path the pre-file reading of operating system;
Described operating system is Windows operating system;
Module is opened in described path, specifically also for, when default time arrives at timer, call the device path that createfile function in Windows operating system is opened record, the current target USB device list that is plugged into USB port of control operation system refresh simultaneously.
10. device according to claim 7, is characterized in that, the described default time is 100~500 milliseconds.
CN201310395534.4A 2013-09-03 2013-09-03 Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment Expired - Fee Related CN103440214B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310395534.4A CN103440214B (en) 2013-09-03 2013-09-03 Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310395534.4A CN103440214B (en) 2013-09-03 2013-09-03 Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment

Publications (2)

Publication Number Publication Date
CN103440214A true CN103440214A (en) 2013-12-11
CN103440214B CN103440214B (en) 2017-01-18

Family

ID=49693905

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310395534.4A Expired - Fee Related CN103440214B (en) 2013-09-03 2013-09-03 Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment

Country Status (1)

Country Link
CN (1) CN103440214B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598798A (en) * 2016-12-19 2017-04-26 四川长虹电器股份有限公司 Method of Android intelligent device to detect USB device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963950A (en) * 2010-09-30 2011-02-02 北京飞天诚信科技有限公司 Method for positioning USB port in connection of device
CN102236618A (en) * 2011-06-15 2011-11-09 深圳市江波龙电子有限公司 Mass production method and system thereof for USB (universal serial bus) devices
CN102567268A (en) * 2010-12-31 2012-07-11 重庆重邮信科通信技术有限公司 Detection method for USB to virtual serial port/MODEM

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963950A (en) * 2010-09-30 2011-02-02 北京飞天诚信科技有限公司 Method for positioning USB port in connection of device
CN102567268A (en) * 2010-12-31 2012-07-11 重庆重邮信科通信技术有限公司 Detection method for USB to virtual serial port/MODEM
CN102236618A (en) * 2011-06-15 2011-11-09 深圳市江波龙电子有限公司 Mass production method and system thereof for USB (universal serial bus) devices

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598798A (en) * 2016-12-19 2017-04-26 四川长虹电器股份有限公司 Method of Android intelligent device to detect USB device
CN106598798B (en) * 2016-12-19 2019-11-19 四川长虹电器股份有限公司 The method of Android intelligent equipment detection USB device

Also Published As

Publication number Publication date
CN103440214B (en) 2017-01-18

Similar Documents

Publication Publication Date Title
CN104317694B (en) Whole machine testing method and device
CN105677311B (en) A kind of recognition methods of function calling relationship and device
CN104980552B (en) Realize the method and system of Android mobile terminal automatic test
CN101562906A (en) Method and device for automatically adapting to wireless data cards with multiple formats
CN102929762A (en) Method and device for monitoring health state of terminal equipment
CN104461846A (en) Method and device for detecting power consumption of application program
CN104765705A (en) Method and device for reading data stored by turned-off mobile terminal and mobile terminal
CN103929676A (en) Method for testing function of smart television board card in remote-control mode and smart television board card
CN105677533B (en) Application process monitoring method and application process monitoring device
CN106469078A (en) A kind of upgrade method of intelligent appliance and device
KR20120048350A (en) Automatic test system for micro controller unit and method thereof
CN103176901A (en) Method and system for embedded software test monitoring
CN103440214A (en) Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment
CN104268193A (en) Advertisement webpage intercepting method and device
CN104750600A (en) Equipment state recording method and equipment state recording system
CN104636661A (en) Method and system for analyzing Android application program
CN106445810B (en) A kind of test method and system of interactive software and equipment compatibility
CN105004957A (en) SD card test method and test device
CN104156329A (en) Method of implementing USB equipment plug identification in dynamic link library
CN104572464B (en) The automatic test state saving approach and device of a kind of Android platform
CN105141993B (en) The method and system that a kind of information orientation is launched
CN103425558B (en) A kind of method realizing the test of board I/O port based on test configurations table
CN103530133A (en) Custom operation method and device for terminal
CN105279013A (en) Method and device for program issuance based on volume production
CN103245856B (en) A kind of test the method for electronic equipment performance, equipment and system

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20170118

Termination date: 20180903