Re: [w3c/gamepad] "STANDARD GAMEPAD" should be defined in a separate attribute (#129)

The ID string format isn't specified by the spec (even if it maybe should have been), the "STANDARD GAMEPAD" string is inserted by Chrome only when `mapping` is "standard", so there's no need for a separate `type` attribute.

https://html5gamepad.com/controllers conveniently logs all the ID strings it has seen.

In Chrome, the ID string is one of these:

%s (Vendor: %04x Product: %04x)   <-- unrecognized HID gamepad
%s (STANDARD GAMEPAD Vendor: %04x Product: %04x) <-- any recognized USB or Bluetooth gamepad
%s (STANDARD GAMEPAD)  <-- Game Controller on macOS
Xbox 360 Controller (XInput STANDARD %s) <-- XInput on Windows

There are XInput IDs for different controller types, I've never actually seen any of these except STANDARD GAMEPAD:

Xbox 360 Controller (XInput STANDARD GAMEPAD)
Xbox 360 Controller (XInput STANDARD WHEEL)
Xbox 360 Controller (XInput STANDARD ARCADE_STICK)
Xbox 360 Controller (XInput STANDARD FLIGHT_STICK)
Xbox 360 Controller (XInput STANDARD DANCE_PAD)
Xbox 360 Controller (XInput STANDARD GUITAR)
Xbox 360 Controller (XInput STANDARD GUITAR_ALTERNATE)
Xbox 360 Controller (XInput STANDARD DRUM_KIT)
Xbox 360 Controller (XInput STANDARD GUITAR_BASS)
Xbox 360 Controller (XInput STANDARD ARCADE_PAD)

In Firefox:

%04x-%04x-%s
xinput

We can't modify `id` itself because it would break applications that rely on collections of known ID strings for device identification. We could add new `productName`, `vendorId`, and `productId` attributes to break out the components of the ID string. The vendor and product IDs should be optional because those IDs are specific to USB and Bluetooth devices. The product name should be a string suitable for display in a user-facing context like a chooser dialog. I think the spec should explicitly warn against using the product name as a stable identifier. That way the browser could choose to provide better strings than those reported by the device.

I don't think we should expose the vendor/manufacturer name reported by the device. This information isn't as useful for identification because different devices from the same vendor may report different strings. Sometimes Chrome pulls the vendor name into the ID string because it's included by the platform API used for device enumeration, for instance here's DS4 v1 and DS4 v2 on different platforms:

Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)
Sony Computer Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 05c4)

Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)
Sony Interactive Entertainment Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)

It really shouldn't include the vendor name string but it's too late to change it. Also note that the vendor name is reported differently for DS4 v1 vs DS4 v2 even though the vendor ID is the same.

Modifying your example (new attributes in bold):

id: whatever is currently reported
mapping: "standard"
**productName**: "Xbox 360 Controller"
**vendorId**: "045e"
**productId**: "028e"

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/gamepad/issues/129#issuecomment-640806444

Received on Monday, 8 June 2020 18:48:43 UTC