The device identification string plays an important role in the enumeration and loading process of the driver device. Device ID string is generally dividedHardware identifier string, compatibility identifier string, and device identifier stringThese types. These identifiers are actually driven by the upper-levelProgram(Usually a bus driver), which is used by the Windows system to find and load the corresponding driver.
For example, when you insert a USB flash drive, the USB bus will detect that the USB flash drive device is inserted, and then it will create the PDO of the USB flash drive device, at the same time, this PDO will generate an identifier string, as you can see in the details of the device Properties dialog box in the Device Manager:
Device sample ID:
USB \ vid_123a & pid_567b \ 1234567890 abcdef
Hardware ID:
USB \ vid_123a & pid567b & rev_0001
USB \ vid_123a & pid567b
Compatible ID:
USB \ class_08 & subclass_06 & pro_50
USB \ class_08 & subclass_06
USB \ class_08
The identification strings produced by each device are different. In particular, for USB devices, the generation of these identification strings is standardized.
USB devices are divided into single-function devices and multi-function devices. A single-function device is the most common device, such as a USB flash drive or a mouse. A multi-function device is a device with multiple interface descriptors in the device descriptor, such as a USB handle, including buttons, a receiver, and a receiver, the key part defines the hid interface, and the receiver and receiver part defines the audio interface.
The enumeration of a Multi-Function Device is more complex than that of a single-function device. the USB bus must first load the USB ccgp. SYS driver. Then, the driver continues to enumerate devices according to each function interface.
Hardware ID string
It is composed of multiple substrings separated by \ 0 and ended with \ 0 \ 0.
For common single-function devices, it is generally two sub-strings, and the first string is
USB \ vid_xxxx & pid_xxxx & rev_xxxx, each XXXX is a 4-digit hexadecimal number, indicating the vendor
ID, product ID, and revision ID. Generally, these three items can accurately determine a specific device. But in general, Revision
ID is not very important. It can be left unspecified during Device Driver Installation, so the second string USB \ vid_xxxx & pid_xxxx is available.
A Multi-Function Device generally contains a sub-string USB \ vid_xxxx & pid_xxxx & mi_xx. The previous XXXX represents the vendor ID and product ID respectively, and the XX represents the number of interfaces, interface descriptor with the deviceBinterfacenumberItems are consistent.
Compatible ID string
It is also composed of multiple substrings separated by \ 0 and ended with \ 0 \ 0.
For common single-function devices, it is generally three sub-strings, and the first string is
USB \ class_xx & subclass_xx & prot_xx, each XX is a two-digit hexadecimal number, indicatingClass
ID, subclass ID, protocol ID. Generally, these three protocols can precisely determine which type of device the device belongs. Class
ID is the most important. The other two items may be ignored, so the second and third sub-strings are available: USB \ class_xx & subclass_xx,
USB \ class_xx.
For a multi-function device, it is generally four sub-strings, and the first three sub-strings are similar
Of: USB \ devclass_xx & subclass_xx & prot_xx, USB
\ Devclass_xx & subclass_xx, USB \ devclass_xx, and the fourth substring is USB \ composite.