none
How do you get the raw descriptor data from a HID device in Windows? RRS feed

  • Question

  • How do you get the raw descriptor data from a HID device in Windows?

    Background:

    I need to get the Manufacturer, Product Name, and Serial Number from a HID device in Windows. I'm using hid.dll to access the devices using the functions seen here. I am able to get the manufacturer string and product string from SOME HID devices, but most fail to return this data with HidD_GetManufacturerString returning false. However, I KNOW these devices do have the string information in their descriptors because I am able to see it using USBTreeView.

    The interesting thing is, even for the devices that do return manufacturer and product names, the values I'm getting through hid.dll are very different from the values I see using the USBTreeView which gets the raw data from the USB device.

    For example, an Xbox 360 controller:

    Via USB Tree View:
    Device Description       : Xbox 360 Controller for Windows
    Language 0x0409          : "©Microsoft Corporation"
    iProduct                 : 0x02
    Language 0x0409          : "Controller"
    iSerialNumber            : 0x03
    Language 0x0409          : "0843806"
    
    Via hid.dll using HidD_GetManufacturerString, HidD_GetProductString, and HidD_GetSerialNumberString:
    Description              : HID-compliant game controller
    Product                  : Controller (XBOX 360 Controller for Windows)
    Manufacturer             : FAILS
    Serial Number            : FAILS

    WinUSB is unable to open these devices at all to retrieve this data as they do not use the winusb.sys driver.

    1) I don't understand why the values returned by the HidD functions do not match the values in the USB descriptor.
    2) I can't find any way to access the raw USB descriptor data for a HID device because I cannot access them with WinUSB.

    Sunday, October 5, 2014 2:05 AM

All replies

  • Here's a clue: not all HID devices are USB.

    -- pa

    Okay, I get your point. It's information from the HID driver, not the USB device itself. So the question still remains, how would one go from having a HID device to getting the underlying USB device (assuming the HID devices is a USB device.) Thus far, I've only found IOCTL functions to do this. Would there be an issue with using IOCTL for this in an ordinary application that doesn't have admin access. (I don't want to set off UAC).

    If none of this makes sense, I'm not surprised because I'm totally new at doing anything this low-level. I'm not trying to write a driver, BTW. I only want to be able to get the USB descriptor information for a USB HID device that I obtained through RawInput. All I need is to know which library to use and I'll figure out the rest.



    • Edited by GuavamanX Sunday, October 5, 2014 7:26 PM
    Sunday, October 5, 2014 7:25 PM
  • usually raw descriptors are not returned to apps, there is no way to use them if you have them

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Sunday, October 5, 2014 8:22 PM