Re: [w3c/gamepad] Add vendorId, productId, name attributes (PR #202)

> Why do we need vendor/product/name at all here? Is it for some feature detection that existing methods do not cover well?

Vendor/product IDs enable applications to identify the gamepad model which can be useful when trying to show icons that match the labels on the gamepad's buttons. Currently, applications use Gamepad.id for this but it's not a good identifier because the content of ID string is explicitly not specified and there's no guarantee that the value will remain stable over time. The vendor/product IDs come from the device firmware so they're unlikely to change except by firmware update.

It's also used for feature detection when deducing which "extra" buttons are available. We're trying to solve that use case with a GamepadButton.type attribute for identifying buttons that aren't part of the Standard Gamepad: #196

A human-readable name is important because there may be multiple gamepads connected and the application may need to ask the user to identify a connected gamepad. Gamepad.id can also be used for this but it typically includes other information like vendor/product IDs that makes it less human-readable.

Mostly we want to add these attributes so that developers can eliminate browser-specific logic for parsing this information out of the underspecified Gamepad.id string.


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

Message ID: <w3c/gamepad/pull/202/c2111419548@github.com>

Received on Wednesday, 15 May 2024 01:31:09 UTC