3

How does DirectInput generate the GUID for the guidProduct field in DIDEVICEINSTANCE? The documentation reads:

guidProduct

Unique identifier for the product. This identifier is established by the manufacturer of the device.

I am searching for a way to retrieve or synthesize the product GUID for a joystick without using DirectInput. I have successfully used RawInput to retrieve the device path and class GUID, but I have not yet found a way to retrieve the product GUID using RawInput and/or SetupDi* functions.

While searching, I noticed that MAKELONG(VID, PID) == guidProduct.Data1, which makes me hopeful that there is way to do what I want (DirectInput somehow does it, after all.)

Questions:

  1. Is there an API to retrieve the product GUID for an HID (esp. joystick) device?
  2. If not, does anyone know how DirectInput synthesizes this field? (The first fields combines VID and PID. What about the rest?)

Edit:

By hacking around the guidProduct field, I came across an interesting discovery. The product GUID for the P880 USB gamepad has the following format:

010906a3-0000-0000-0000-504944564944

The first 4 bytes are quite evidently the PID and VID for the controller. The last part of the GUID is common for all HID controllers in my possession. After a while it dawned on me - they are ASCII characters! The translation is:

010906a3-0000-0000-0000-504944564944
010906a3-0000-0000-0000- P I D V I D
PID_VID_-0000-0000-0000-'P I D"V I D'

I have verified this using the SDL2 game controller database, and it appears to hold! Of course, this does not cover bluetooth devices (such as the OUYA controller), which is only a minor issue for now.

Does anyone know how guidProduct is composed for bluetooth devices?

The Fiddler
  • 2,726
  • 22
  • 28
  • As far as I know the product GUID is meaningless outside of DirectInput, so why do you need to know it outside of DirectInput? – Ross Ridge Sep 02 '14 at 20:47
  • Because I need to interoperate with existing gamepad configurations based on the DirectInput product GUIDs. – The Fiddler Sep 02 '14 at 21:24

0 Answers0