SLAA453A january 2011 – may 2023
Throughout the rest of this document, the following terms are used:
As the host application developer sets about accessing the USB device, he or she generally knows the VID/PID pair of the device to which it is being associated, because both are usually designed by the same party. The process therefore begins with calling HID_GetSerNums(). This function receives a VID/PID as parameters and returns a list of serial numbers, each of which represents a physical USB device on the bus associated with that VID/PID. The application may choose to interact with only one of these physical devices, or it could be given capability of interacting with multiple devices.
The application developer also generally knows how many interfaces each of these physical devices has. If somehow this is not known, the function HID_GetNumOfInterfaces() can be called. When HID_Open() is called to open the device, it is necessary to know the total number of HID interfaces on the physical device.
When the VID, PID, and serial number are used to filter the HID device list, all that remains is a list that represents all of the HID interfaces in the physical USB device described by those parameters. This list is usually one or two, but can be as many as eight on an MSP430. The order of this list is the same as the order in which the HID interfaces were listed in the physical device's USB descriptors. In this way, the host application and MSP430 application using the API stack can "find" each other, forming a complete data link.
Armed with the VID/PID, serial number, and index of the desired HID interface within the USB device, the application can call HID_Open() to open a connection to the HID interface on the physical USB device.
When the application is finished using the device (for example when exiting the program), the application should close any open HID devices with HID_Close().