CN103440214B - 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
CN103440214B
CN103440214B CN201310395534.4A CN201310395534A CN103440214B CN 103440214 B CN103440214 B CN 103440214B CN 201310395534 A CN201310395534 A CN 201310395534A CN 103440214 B CN103440214 B CN 103440214B
Authority
CN
China
Prior art keywords
usb
equipment
operating system
target
record
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
CN201310395534.4A
Other languages
Chinese (zh)
Other versions
CN103440214A (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

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 equipment
Technical field
The present invention relates to usb equipment detection field, the method for more particularly, to a kind of quick identification grafting usb equipment and dress Put.
Background technology
Generally, for guaranteeing the correctness of product function, pc peripheral product (such as keyboard, mouse, game paddle etc.) is being given birth to It is typically necessary during product and carries out Product checking, and pc peripheral product major part is all based on the equipment of usb interface, when therefore detecting Typically product will be inserted into the usb port on pc, then Product checking is carried out by the test software installed in pc, pc sets to usb Standby recognition speed will directly influence production efficiency.
According to statistics, pre-installed the pc of windows operating system, the difference of the practical situation according to pc hardware configuration, The recognition time that windows xp operating system plugs to usb equipment is about 2~5 seconds, and this time is for domestic consumer Can accept completely, but for factory work, the knowledge of the usb equipment to grafting for the prior art windows xp operating system The other time is oversize, constrains factory work efficiency.
Therefore, prior art could be improved.
Content of the invention
It is an object of the invention to provide a kind of method of quick identification grafting usb equipment, shorten operating system to slotting The recognition time of the usb equipment connecing.
For reaching this purpose, the present invention employs the following technical solutions:
One aspect of the present invention provides a kind of method of quick identification grafting usb equipment, comprising:
Record the device path of every an article or item in a contract mark usb apparatus connecting corresponding generation in an operating system when different usb port, The information of one device path and a usb port, the information of a target usb equipment;
Open the device path of record according to default time cycle property, to identify target usb being plugged on usb port Equipment.
Wherein, described record that every an article or item in a contract mark usb apparatus connecting is corresponding in an operating system when different usb port to be generated Device path, comprising:
Detect whether each usb port is plugged with target usb equipment respectively;
If a certain usb port is plugged with target usb equipment, generate to should usb port and this target in an operating system One device path of usb equipment;
Record the device path of generation respectively.
Wherein, if described a certain usb port is plugged with target usb equipment, generate to should usb port in an operating system After a device path of this target usb equipment, also include:
Described device path is set as the pre-read file of operating system.
Wherein, the described device path opening record according to default time cycle property, comprising:
One intervalometer of setting, this intervalometer is according to default time cycle property timing;
When arriving the intervalometer default time, the function reading file in call operation system opens the equipment road of record Footpath.
Wherein, described operating system is windows operating system;
The function reading file in described call operation system opens the device path of record, particularly as follows:
The createfile function in windows operating system is called to open the device path of record, control operation simultaneously System refresh is currently plugged into the target usb list of devices of usb port.
Wherein, the described default time is 100~500 milliseconds.
Another aspect of the present invention additionally provides a kind of device of quick identification grafting usb equipment, comprising:
Paths record module is right in an operating system when different usb port for recording every an article or item in a contract mark usb apparatus connecting The device path that should generate, the information of a device path and a usb port, the information of a target usb equipment;
Module is opened in path, for the device path opening record according to default time cycle property, slotting to identify It is connected on the target usb equipment of usb port.
Wherein:
Described paths record module, specifically for detecting whether each usb port is plugged with target usb equipment respectively;If A certain usb port is plugged with target usb equipment, generate in an operating system to should usb port and this target usb equipment one Individual device path, described device path comprises the information of this usb port, the information of this target usb equipment;Record generates respectively Device path;
Module is opened in described path, specifically for arranging an intervalometer, this intervalometer is according to default time cycle property Timing;When arriving the intervalometer default time, the function reading file in call operation system opens the device path of record, To identify the target usb equipment being plugged on usb port.
Wherein:
Described paths record module, is additionally operable to device path is set as the pre-read file of operating system;
Described operating system is windows operating system;
Module is opened in described path, is specifically additionally operable to, and when arriving the intervalometer default time, calls windows to operate Createfile function in system opens the device path of record, and control operation system refresh is currently plugged into usb end simultaneously The target usb list of devices of mouth.
Wherein, the described default time is 100~500 milliseconds.
Implement the embodiment of the present invention, have the advantages that
The embodiment of the present invention is right in an operating system when different usb port by pre-recorded target usb apparatus connecting The device path that should generate, the device path of record is reusable.The letter of every call operation system at regular intervals Number opens the device paths (even if when usb equipment is not also plugged on usb port) of record, and then identifies and be plugged on correspondence The corresponding target usb equipment of usb port;By present invention reduces the recognition time of the usb equipment to grafting for the operating system.
Brief description
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Have technology description in required use accompanying drawing be briefly described it should be apparent that, drawings discussed below is only this Some bright embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also root Obtain other accompanying drawings according to these accompanying drawings.
Fig. 1 is the flow chart of the method first embodiment of a kind of quick identification grafting usb equipment of the present invention.
Fig. 2 is the flow chart of the method second embodiment of a kind of quick identification grafting usb equipment of the present invention.
Fig. 3 is the structural representation of the device embodiment of a kind of quick identification grafting usb equipment of the present invention.
Specific embodiment
Accompanying drawing with reference to the present invention carries out clear, complete description to the technical scheme in the embodiment of the present invention, shows So, described embodiment is only a part of embodiment of the present invention, rather than whole embodiments.Based in the present invention Embodiment, the every other embodiment that those of ordinary skill in the art are obtained on the premise of not making creative work, Broadly fall into the scope of protection of the invention.
Below in conjunction with accompanying drawing 1- accompanying drawing 2, the method for quick identification grafting usb equipment provided in an embodiment of the present invention is entered Row is discussed in detail.
Refer to Fig. 1, Fig. 1 is a kind of flow process of an embodiment of method of quick identification grafting usb equipment of the present invention Figure, the method specifically includes following steps s1-s3.
Step s1, pre-recorded every an article or item in a contract mark usb apparatus connecting is corresponding in an operating system when different usb port to be generated Device path, the information of a device path and a usb port, the information of a target usb equipment;I.e. device path bag Include information, the information of corresponding a target usb equipment of corresponding usb port.
In the embodiment of the present invention, described target usb equipment is the usb equipment needing detection, and same an article or item in a contract mark usb equipment is inserted When being connected on different usb port, different device paths will be generated in an operating system, different an article or item in a contract mark usb apparatus connectings are same During one usb port, also will generate different device paths in an operating system;Therefore, a device path of the present embodiment, be Corresponding with the combination of a target usb equipment and a usb port.
Described different usb ports are the different usb ports of pc, and described operating system is the operating system of this pc, including But it is not limited to windows operating system.Taking windows operating system as a example the present invention will be described for the present embodiment.
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 " represents the information of usb equipment, field " 6&723e50&0&2 " and " { a5dcbf10-6530-11d2-901f- 00c04fb951ed } " represent the information of usb port.
The vid/pid of the same a usb equipment by being produced on production line must be the same, once so this usb When apparatus connecting is on the same usb port of pc, the device path that windows operating system distributes to this usb equipment must be The same.After device path is recorded, this device path can Reusability, that is, next time with a usb apparatus connecting to phase During the usb port answered, device path need not be regenerated.
Step s2, according to the device path opening record of default time cycle property, is plugged on usb port to identify Target usb equipment.
In the embodiment of the present invention, even if when target usb equipment is not also plugged on usb port, also can be when default Between the function of call operation system open the device path of record once, this operation will force operating system active go to refresh current It is plugged into the list of devices of usb port.Preferably, the described default time is 100~500 milliseconds.
Because the device path of record is reusable, it is plugged on by periodically opening device path and then identify The target usb equipment of usb port, accelerates the recognition speed of the target usb equipment to grafting.
By the method for the quick identification grafting usb equipment of the above embodiment of the present invention, by pre-recorded, every an article or item in a contract mark The device path of usb apparatus connecting corresponding generation in an operating system when different usb port, then adjusts every the default time The device path opening record with the function of operating system once, thus shortening target usb to the usb port being plugged into pc The recognition time of equipment, is conducive to improve the working performance that factory is detected to target usb equipment.
Method in order to a kind of quick identification grafting usb equipment of the present invention is explained in more detail, present invention also offers A kind of flow chart of the second embodiment of method of quick identification grafting target usb equipment.The present embodiment is applied in windows On the pc of operating system, this pc comprises multiple usb ports.Refer to Fig. 2, comprise the steps s21-s27.
Step s21, after initialization success, detects each usb port respectively.
Step s22, whether usb port is plugged with target usb equipment?If so, next step, otherwise, return to step are executed s21.
Step s23, generates a corresponding device path in an operating system, and this device path comprises this usb port Information, the information of this target usb equipment.Record this device path.
If this pc comprises 4 usb ports, same target usb equipment at most can correspond to 4 in the operating system of this pc Device path.
In the present embodiment, described device path can be set as the pre-read file of operating system, fast oil (gas) filling device path Opening speed.Windows under the system disk of windows operating system prefetch file be exactly to store pre-read file Path, have many files with pf as extension name, i.e. pre-read file in prefetch file.
Step s24, arranges an intervalometer, this intervalometer is according to default time cycle property timing.Enter dormancy to wait.
Step s25, whether the intervalometer default time arrives?If so, execute next step, otherwise, re-execute this step.
Step s26, the function reading file in call operation system opens the device path of record.In windows operation In system, that is, the createfile function in windows operating system is called to open the device path of record, control operation simultaneously System refresh is currently plugged into the list of devices of usb port.
Step s27, identifies the target usb equipment being plugged on usb port by list of devices.
Terminate.
By above-described embodiment, pre-recorded every an article or item in a contract mark usb apparatus connecting when different usb port in an operating system The corresponding device path generating, and device path record after can Reusability;Again every default time call operation system The function of system opens the device path of record once, when shortening the identification to the target usb equipment of the usb port being plugged into pc Between, be conducive to improve the working performance that factory is detected to target usb equipment.
It is below the embodiment of device provided in an embodiment of the present invention.The embodiment of device is belonged to above-mentioned embodiment of the method In same design, the embodiment of device, the detail content of not detailed description, may be referred to said method embodiment.
Below in conjunction with accompanying drawing 3, to quick identification grafting usb equipment provided in an embodiment of the present invention device carry out in detail Thin introduction.It should be noted that following apparatus can apply to execute said method.
Refer to Fig. 3, described device includes: paths record module 310, path open module 320.
Paths record module 310, for recording every an article or item in a contract mark usb apparatus connecting when different usb port in operating system The middle corresponding device path generating, the information of a device path and a usb port, the information of a target usb equipment.Tool Body, with reference to described in above-described embodiment, does not repeat.
Module 320 is opened in path, for the device path opening record according to default time cycle property, to identify It is plugged on the target usb equipment of usb port.With specific reference to described in above-described embodiment, do not repeat.
Preferably, wherein, described paths record module 310, specifically for: in initial phase, detect each usb respectively Whether port is plugged with target usb equipment;If usb port is plugged with target usb equipment, generate corresponding one in an operating system Individual device path, described device path comprises the information of this usb port, the information of this target usb equipment;Record generates respectively Device path.Preferably, described device path is set as the pre- of operating system by paths record module described in the present embodiment 310 Read file.With specific reference to described in above-described embodiment, do not repeat.
Module 320 is opened in described path, specifically for arranging an intervalometer, this intervalometer is according to week default time The timing of phase property;When arriving the intervalometer default time, the function reading file in call operation system opens the equipment of record Path, simultaneously control operation system refresh be currently plugged into the target usb list of devices of usb port, by target usb equipment arrange Table identifies the target usb list of devices being plugged on usb port.With specific reference to described in above-described embodiment, do not repeat.
Wherein.The described default time is 100~500 milliseconds.
By implementing the above embodiment of the present invention, by pre-recorded every an article or item in a contract mark usb apparatus connecting at different usb ends Mouthful when the corresponding device path generating in an operating system, and device path record after can Reusability;Again every default The function of time call operation system open the device path of record once, shorten the mesh to the usb port being plugged into pc The recognition time of mark usb equipment, is conducive to improve the working performance that factory is detected to target usb equipment.
Above disclosed only present pre-ferred embodiments, the right that certainly can not limit the present invention with this will Seek scope, therefore, all any modification, equivalent and improvement made within the spirit and principles in the present invention etc., still belong to this Invent covered scope.

Claims (9)

1. a kind of method of quick identification grafting usb equipment is it is characterised in that include:
Record every an article or item in a contract mark usb apparatus connecting corresponding device path generating in an operating system when different usb port, one Device path includes the information of a usb port and the information of a target usb equipment;
Open the device path of record according to default time cycle property, to identify that target usb being plugged on usb port sets Standby;
The described device path opening record according to default time cycle property, comprising:
One intervalometer of setting, this intervalometer is according to default time cycle property timing;
When arriving the intervalometer default time, the function reading file in call operation system opens the device path of record.
2. the method for quick identification grafting usb equipment according to claim 1 is it is characterised in that the every an article or item in a contract of described record The device path of mark usb apparatus connecting corresponding generation in an operating system when different usb port, comprising:
Detect whether each usb port is plugged with target usb equipment respectively;
If a certain usb port is plugged with target usb equipment, generate to should usb port and this target usb set in an operating system A standby device path;
Record the device path of generation respectively.
If 3. the method for quick identification grafting usb equipment according to claim 2 is it is characterised in that described a certain usb end Mouthful be plugged with target usb equipment, generate in an operating system to should usb port and this target usb equipment an equipment road After footpath, also include:
Described device path is set as the pre-read file of operating system.
4. the method for quick identification grafting usb equipment according to claim 1 is it is characterised in that described operating system is Windows operating system;
The function reading file in described call operation system opens the device path of record, particularly as follows:
The createfile function in windows operating system is called to open the device path of record, control operation system simultaneously Refresh the target usb list of devices being currently plugged into usb port.
5. the method for quick identification grafting usb equipment according to claim 1 is it is characterised in that the described default time For 100~500 milliseconds.
6. a kind of device of quick identification grafting usb equipment is it is characterised in that include:
Paths record module, for recording the corresponding life in an operating system when different usb port of every an article or item in a contract mark usb apparatus connecting The device path becoming, a device path includes the information of a usb port and the information of a target usb equipment;
Module is opened in path, for the device path opening record according to default time cycle property, is plugged on identifying The target usb equipment of usb port;
Module is opened in described path, specifically for arranging an intervalometer, this intervalometer is according to default time cycle property meter When;When arriving the intervalometer default time, the function reading file in call operation system opens the device path of record, with Identify the target usb equipment being plugged on usb port.
7. device according to claim 6 it is characterised in that:
Described paths record module, specifically for detecting whether each usb port is plugged with target usb equipment respectively;If a certain Usb port is plugged with target usb equipment, generates to should of usb port and this target usb equipment set in an operating system Standby path, described device path comprises the information of this usb port, the information of this target usb equipment;Record the equipment of generation respectively Path.
8. device according to claim 7 it is characterised in that:
Described paths record module, is additionally operable to device path is set as the pre-read file of operating system;
Described operating system is windows operating system;
Module is opened in described path, is specifically additionally operable to, and when arriving the intervalometer default time, calls windows operating system In createfile function open the device path of record, control operation system refresh is currently plugged into usb port simultaneously Target usb list of devices.
9. device according to claim 6 it is characterised in that the described default time be 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 CN103440214A (en) 2013-12-11
CN103440214B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106598798B (en) * 2016-12-19 2019-11-19 四川长虹电器股份有限公司 The method of Android intelligent equipment detection 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

Also Published As

Publication number Publication date
CN103440214A (en) 2013-12-11

Similar Documents

Publication Publication Date Title
CN103338290B (en) A kind of method of automatic test Android phone touch screen performance
CN103425574B (en) A kind of method and device of test application program
CN105680960B (en) A kind of Bluetooth card reader automated testing method, test host computer and test system
CN103149526B (en) PCBA board test macro and method
CN102375778A (en) Method and system for automatically testing digital signal processor (DSP)
CN105760296B (en) Automatic test control method, device and terminal
CN104915297B (en) A kind of automated testing method of the APP power consumption of android equipment
CN111756575A (en) Performance analysis method and device of storage server and electronic equipment
CN101562906A (en) Method and device for automatically adapting to wireless data cards with multiple formats
CN105608258A (en) Model based system design and information flow visualization simulation system and method
CN101276319B (en) Equipment and method for making USB interface to time-sharing apply as standard I /O interface
CN106598834A (en) UI (User Interface) testing method and device
CN104866421A (en) Testing method and testing system of POS terminal
CN105933767A (en) Middleware device, middleware realization method and television set
CN106250429A (en) A kind of data pick-up method based on sqoop
CN103530166B (en) Verification platform and verification method for multi-channel chip based on virtual RAM
CN103809051B (en) The detection method of switch matrix, Auto-Test System and switch matrix therein
CN102014023B (en) VB Script based automatic testing method of network equipment products
CN103440214B (en) Method and device for rapidly identifying plugged USB (Universal Serial Bus) equipment
CN104050069A (en) Automated testing method for achieving correctness of MIPS processor by judging Verilog based on Mars
CN102135939A (en) Test case operation dispatching device and method
CN106896956B (en) The implementation method of multi-point touch under one kind " road " system
CN106951184A (en) A kind of Bluetooth address generation method
CN104199779B (en) A kind of method and system of flush bonding module combined test
CN104239047B (en) The method and its device of a kind of information gathering

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