HID application programming interface (API)
There are three categories of HID APIs:
- Device discovery and setup
- Data movement
- Report creation and interpretation
Device discovery and setup
These HID APIs are used to identify the properties of a HID device and to establish communication with that device. Applications use these APIs to identify a top level collection.
- HidD_GetAttributes
- HidD_GetHidGuid
- HidD_GetIndexedString
- HidD_GetManufacturerString
- HidD_GetPhysicalDescriptor
- HidD_GetPreparsedData
- HidD_GetProductString
- HidD_GetSerialNumberString
- HidD_GetNumInputBuffers
- HidD_SetNumInputBuffers
Data movement
The following HID APIs are used to move data between an application and a selected device.
Report creation and interpretation
Developers of custom hardware know the size and format of each report issued by their device. In this case, the application can cast the input and output report buffers as structs and consume the data.
Developers of HID applications intended to communicate with all devices that expose common functionality might not know the size and format of the HID reports. This category of application understands certain top level collections and certain usages.
To interpret the reports received from a device or to create reports to be sent the application must use the report descriptor to determine if and where a particular usage is located in the reports and the units of values in the reports. In these cases, HID parsing is required. Windows provides a HID parser for use by drivers and applications via APIs (HidP_*) that can be used to discover the types of usages supported by a device, determine the state of such usages in a report, or to build a report to change the state of a usage in the device.
Here's the list of HID parser APIs:
- HidP_GetButtonArray
- HidP_GetButtonCaps
- HidP_GetButtons
- HidP_GetButtonsEx
- HidP_GetCaps
- HidP_GetData
- HidP_GetExtendedAttributes
- HidP_GetLinkCollectionNodes
- HidP_GetScaledUsageValue
- HidP_GetSpecificButtonCaps
- HidP_GetSpecificValueCaps
- HidP_GetUsages
- HidP_GetUsagesEx
- HidP_GetUsageValue
- HidP_GetUsageValueArray
- HidP_GetValueCaps
- HidP_GetVersion
- HidP_InitializeReportForID
- HidP_MaxDataListLength
- HidP_MaxUsageListLength
- HidP_SetButtonArray
- HidP_SetButtons
- HidP_SetData
- HidP_SetScaledUsageValue
- HidP_SetUsages
- HidP_SetUsageValue
- HidP_SetUsageValueArray
- HidP_TranslateUsagesToI8042ScanCodes
- HidP_UnsetButtons
- HidP_UnsetUsages
- HidP_UsageAndPageListDifference
- HidP_UsageListDifference