Hi,
I've been trying for a week to come up with a way to get the parent USB device only having a HID device (assuming USB). I want to get information from its descriptor since it seems the information returned at the HID level is different. I would also like to be able to identify the USB hub and port number the device is attached to so I can sort my HID devices by USB port (even if this isn't meaningful to the user, at least the order will be consistent from reboot to reboot as long as devices are attached to the same location).
Example of different info returned by HID vs USB:
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
So far, I've been able to get some useful information from the HID device, but the information I imagine that I'd need to make the connection between a HID device and the parent USB device seems to be missing. I'm thinking I might be able to get the USB device from the PDO, but I can't find a way to do that.
Useful information obtained through hid.dll:
Vendor id
Product id
Version
Useful information obtained through setupapi.dll (SetupDiGetDeviceRegistryProperty):
Device Path
Description
Instance id
Hardware id
Manufacturer
PDO
These return blank or nonsense information:
Address
Bus Number
Location Info (I was hoping this would give me the info I need for port sorting, but it is always blank)
Friendly Name
Viewing the devices in USBView, I'm able to see that the HID device is actually a 2nd tier child of the USB device itself.
Device ID's in the hierarchy:
USB device: USB\VID_045E&PID_028E\0843806 <-- This is the USB device I want
Child Device 1: USB\VID_045E&PID_028E&IG_00\6&33D4AC&0&00
(sub) Child Device 1: HID\VID_045E&PID_028E&IG_00\7&2C1CE38F&0&0000 <-- This is the HID device I have access to
I realize I'm probably making a bunch of incorrect assumptions because I'm very new to this area. However, I hope I was able to get across what I'm trying to achieve.
By the way, these devices do not work with WinUSB.