SLAA453A january 2011 – may 2023
Every USB device contains a vendor ID (VID) and a product ID (PID). USB hosts use the VID/PID combination to identify product types. It stands to reason that all products of a given PID from a vendor of a given VID are functionally identical. The host associates all devices with that VID/PID with a particular USB device class – for example, HID or CDC. Whenever it encounters this VID/PID, it loads that particular driver.
Above the Windows HID driver, things look slightly different. The HID driver maintains a list of "HID devices" on the bus, selectable by a generic index, and makes this list available to the host application above it. The "HID devices" in this list are logical entities, not physical USB devices. These logical entities don't necessarily map directly to the physical devices on the bus.
As an example, it is possible that more than one "HID device" with a given VID/PID may be reported to the host application. This could mean there are multiple physical devices of a given product type attached to this host; or it might be that there is a composite device that has multiple HID interfaces (which can be thought of as logical devices). Further, if there are 4+ "HID devices", it is possible that both these factors are involved, as in Figure 3-2.
In this figure, the Windows application cannot immediately know what these "HID devices" represent in the real world.
If the host application wants to be functional in this kind of multiple-device situation – or further, to be able to take advantage of multiple HID datapipes on a physical device – it needs to probe further. One important piece of information it needs to gather from each HID device is the serial number (marked as "sernum" in Figure 3-2). A USB device can optionally report a serial number that identifies a unique piece of physical equipment among all others containing the same VID/PID. (The MSP430 USB API stacks can automatically report a serial number, if selected to do so with the Descriptor Tool.)
Once the host application has the VID, PID, and serial number of every HID device it sees on the bus, it can begin to understand the situation on the bus. If it finds two HID devices with a given VID/PID, with the serial numbers also the same, then it can know this is a composite HID device that has two HID interfaces. If, instead, these two HID devices have different serial numbers, then the application is looking at two physical single-interface HID devices.
With these techniques, the developer can then design devices with multiple HID interfaces, using each one as a datapipe for a particular kind of information – the equivalent of multiple COM ports. Among other benefits, this helps overcome the bandwidth limitation of a single HID interface (64 kbps). As many as eight HID interfaces can be run in parallel on an MSP430, providing 512-kbps bandwidth.
It should be added that if Windows recognizes in the USB descriptors that this device is a mouse or keyboard during initial enumeration, then Windows itself becomes the "host application" for this HID device. It issues report requests and uses the data to control the mouse on the screen or input data for text entry.