w3c / gamepad

Gamepad
https://w3c.github.io/gamepad/
Other
141 stars 48 forks source link

About the id #65

Closed GrosSacASac closed 5 years ago

GrosSacASac commented 6 years ago

An identification string for the gamepad. This string identifies the brand or style of connected gamepad device. Typically, this will include the USB vendor and a product ID.

Is there any guarantee that it is both unique(for all gamepads in the world) and immutable (for a given gamepad) ?

luser commented 6 years ago

Is there any guarantee that it is both unique(for all gamepads in the world) and immutable (for a given gamepad) ?

The id field is incredibly underspecified in general. It came from my original implementation in Firefox where I just wanted some way to expose the vendor and product IDs from the USB device. USB vendor IDs are managed by the USB group, but I've definitely seen the same chipset used in several different cheap USB gamepads with the exact same vendor+product IDs, so it's not a very strong guarantee.

As to immutability, that should always hold true, and we could add spec text to that effect. I'm wary of trying to really spec out the id field, I think it wasn't a great idea in the first place and we should probably just spec something where we can expose things like the vendor and product IDs as separate fields when they're available.

ylafon commented 6 years ago

Using VID:PID seems the most discriminant thing you can use, there is nothing really better that can be done until there are better ways to do local remapping (I see it is a Feature Request. Formally define the Id would be useful later for local remapping. Also adding the device name would be insignificant as names are even more shared then VID:PID.

sgraham commented 6 years ago

I think for v1, it's just a string that might tell you something about the device type. For v2 we can try to separate out vid/pid, or something more helpful.