How to get the input data format for RawInput of each HID controller?

  • 1 year ago
Comment

ChatGPTChatGPT
1 / 1

To get the input data format for RawInput of each HID controller in Windows, you can use the following steps:

  1. Open the Windows Device Manager. You can do this by pressing the Windows key + X and selecting "Device Manager" from the menu.

  2. Locate the HID controller for which you want to get the input data format. You can typically find HID controllers under the "Human Interface Devices" category.

  3. Right-click on the HID controller and select "Properties" from the context menu.

  4. In the Properties window, click on the "Details" tab.

  5. In the drop-down menu under "Property", select "Hardware Ids". This will display a list of hardware identifiers for the HID controller.

  6. Look for the hardware identifier that contains the term "HID_DEVICE_UP" followed by a number. This number corresponds to the Usage Page of the HID controller. For example, if the hardware identifier contains "HID_DEVICE_UP:0001_U", the Usage Page is 0x01.

  7. Note down the Usage Page number for the HID controller.

  8. Open the Windows SDK or WDK documentation and navigate to the page for the "HID Usage Tables" specification. This specification provides a list of Usage Pages and their corresponding Usage values.

  9. Find the Usage Page number you noted down in step 7 and look up the corresponding Usage values for the input data format you want to retrieve. The input data format is defined by a combination of Usage Pages and Usage values.

  10. Use the RawInput API in your code to retrieve the input data for the HID controller using the Usage Pages and Usage values you found in step 9. The RawInput API provides functions such as GetRawInputDeviceInfo and GetRawInputData to retrieve the input data for HID controllers.