none
HID Capabailities RRS feed

  • Question

  • I am trying to get the HID Capabilities of a USB HID device. I need this info to send a setfeature  request based on the FeatureReportByteLength(non-zero) of the HID_CAPS structure. I am able to get the eatureReportByteLength and other values using HidP_GetCaps() and able to send the set feature request and get the desired result. But when I try this in another PC of same version ,FeatureReportByteLength is zero for the same device. So I am not able to send feature request.How could this happen? Is there any difference in the way the USB host controller or stack handles the HID feature reports / capabilities etc? I am using Win 10 .
    Tuesday, June 6, 2017 6:29 PM

Answers

  • HID caps should not change, unless the device reports a different report descriptor.

    1. Make sure you open the right HID top level collection, especially, when there are similar HID devices on a system already. Try unplugging other HID devices and see if your codes will get you the right results.  Or unplug this USB HID device to see if your codes are showing you the same result.

    2. Make sure HidP_GetCaps() returns successful. If it fails, the HID_CAPS structure may have not been filled yet.

    If you are familiar with HID sample HClient, you may use it to inspect the HID devices on a system and check HID caps there as well.

    Wednesday, June 7, 2017 5:57 PM

All replies

  • HID caps should not change, unless the device reports a different report descriptor.

    1. Make sure you open the right HID top level collection, especially, when there are similar HID devices on a system already. Try unplugging other HID devices and see if your codes will get you the right results.  Or unplug this USB HID device to see if your codes are showing you the same result.

    2. Make sure HidP_GetCaps() returns successful. If it fails, the HID_CAPS structure may have not been filled yet.

    If you are familiar with HID sample HClient, you may use it to inspect the HID devices on a system and check HID caps there as well.

    Wednesday, June 7, 2017 5:57 PM
  • Thanks  Andre for the reply. Yes, I guess I was not opening the right HID top level collection. I found the HClient sample and was really helpful. I got the right value of EeatureReportByteLength using this sample . But how do I know which is the right top level collection from the similar collection with other devices present in a real scenario?
    Thursday, June 8, 2017 7:16 AM
  • HIDD_ATTRIBUTES has VID/PID/Version information that may help you to identify a top level collection when there're similar top level collections from the HID devices of different vendors/products/versions. If VID/PID/Version are identical too, you would have to inspect the certain usages in the HID reports to differentiate them.

    If your top level collection doesn't fall into the vendor-defined page range, there are also design questions. Do you want your program to control other similar top level collections too? Or do you want your top level collection to be controlled by other similar programs as well?

    Thursday, June 8, 2017 5:17 PM
  • Thanks Andrew. I shall try to identify using VID/PID. I understand that the same device can have multiple Usage Page and Usage ID. If the device has two sets of UsagePage and Usage IDs, then  if you call the Get_Caps() using one set , then the FeatureReportByteLength will be zero.For the other,FeatureReportByteLength might be the correct value.S o my question is it OK if we go for Device Caps with the non-zero value of FeatureReportByteLength?  Hope my question makes sense.
    Friday, June 9, 2017 12:49 PM
  • Solved the issue finally. Got the capabilities of all interfaces of the device and got EeatureReportByteLength of the interface with the expected value of Page /UsagePage. Thanks for the valuable inputs.

    Friday, June 16, 2017 7:30 AM
  • I'm not sure if this helps you or not, but here is my Hid library. You can see that I am calling HidP_GetCaps(). This seems to work on every computer unless people have experienced issues that I haven't heard about:

    This is the line where the API is called

    HidP_GetCaps() Call

    The library is called Hid.Net. I think you might find it useful in general - if only as a reference.

    Hid.Net


    Tuesday, November 20, 2018 9:56 PM