6

There are various ways to retrieve the Windows "Device Name" of a HID device, GetRawInputDeviceInfo with RIDI_DEVICENAME being one way to do it.

Given the example name:

\?\HID#VID_FEED&PID_DEAD#6&3559c8ea&0&0000#{378de44c-56ef-11d1-bc8c-00a0c91405dd}

I'm wondering if there is any documentation whatsoever on what is what in this string?

\?\HID#VID_AAAA&PID_BBBB#C&DDDDDD&E&FFFF#{GUID}

So the obvious ones are A(VID), B(PID) and the GUID on the end. What I'm wondering is what EXACTLY are C, D, E and F?

It seems that C and D are unique even if you plug in two of the exact same HID devices which is great for my problem, but I'd feel more comfortable if I could know exactly how this is determined on a per OS basis, or at least that it follows some known format.

I have been googling like a madman trying to figure this out, am I missing something obvious?

Thanks in advance

2
  • 1
    Re: "It seems that C and D are unique even if you plug in two of the exact same HID devices which is great for my problem..." What is the problem you're trying to solve, exactly? The exact device name format is an operating system implementation detail. You're not supposed to parse or extract information out from the device name. Commented Feb 20, 2014 at 3:15
  • I am trying to uniquely identify devices and their interfaces/outputs on a per-OS basis. You're right, I shouldn't extract information from the device name, so I won't. Commented Feb 24, 2014 at 16:09

2 Answers 2

4

According to a similar MSDN post, the value represents a unique device instance ID:

the device instance ID is unique and constant for the physical location the device is plugged into, but it is also opaque and should not be parsed. that means it can be used for string comparison, but not for interpretation.

Sign up to request clarification or add additional context in comments.

1 Comment

Very useful, thanks!! The important thing here is "that means it can be used for string comparison, but not for interpretation." That definitely answers my question.
3

This string with GUID on the end - is actually device interface instance id (symbolic link name). And yes, its unique and persists across system restart. Some details also here.

You can use CM_Get_Device_Interface_Property or SetupDiGetDeviceInterfaceProperty on interface instance id with DEVPKEY_Device_InstanceId to get device instance id (one device can have multiple interfaces).

In your example - you have a HID device. Its device id format is described here.

Info on general USB devices id format is here.

After you have device instance id you can use CM_Get_DevNode_Property or SetupDiGetDeviceProperty with DEVPKEY_NAME to get localized friendly name of a device (which is shown in Device Manager).

To sum up:

NOTE: exact device interface id format is not documented, each device interface can generate file name it want. I don't recommend you to parse it - it could be changed in later Windows version, better aquire device instance id - its format is documented.

You can browse these device interfaces in the Sysinternals WinObj tool. They are usually under GLOBAL?? namespace:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.