From 5d4f9b244c0ff5962c8010c8da94ace869f4a470 Mon Sep 17 00:00:00 2001
From: Matt Reynolds
Date: Fri, 26 Apr 2024 18:27:54 -0700
Subject: [PATCH 1/3] Add vendorId, productId, name attributes
---
index.html | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/index.html b/index.html
index 8ca6304..ab1a371 100644
--- a/index.html
+++ b/index.html
@@ -147,6 +147,9 @@
[Exposed=Window]
interface Gamepad {
readonly attribute DOMString id;
+ readonly attribute unsigned short? vendorId;
+ readonly attribute unsigned short? productId;
+ readonly attribute DOMString name;
readonly attribute long index;
readonly attribute boolean connected;
readonly attribute DOMHighResTimeStamp timestamp;
@@ -334,6 +337,47 @@
{{Gamepad/id}} string.
+
+ vendorId attribute
+
+
+
+ The 16-bit identifier assigned to the device vendor by the USB
+ Implementers Forum or Bluetooth Special Interest Group, or `null`
+ if the gamepad has no vendor identifier or it is not available.
+
+
+ The [=user agent=] MAY set {{Gamepad/vendorId}} and
+ {{Gamepad/productId}} to `null` to mitigate the risk of exposing
+ device identifiers. If one of {{Gamepad/vendorId}} or
+ {{Gamepad/productId}} is `null` then both MUST be `null`.
+
+
+
+ productId attribute
+
+
+ The product identifier assigned by the device vendor, or `null` if
+ the gamepad has no product identifier or it is not available.
+
+
+ name attribute
+
+
+
+ A human-readable identifier for the gamepad. The exact content of
+ the {{Gamepad/name}} string is left unspecified. The [=user agent=]
+ MAY use a product name string provided by the device firmware. The
+ {{Gamepad/name}} MUST NOT be the empty string and MUST NOT include
+ unique identifiers like serial numbers or Bluetooth device
+ addresses.
+
+
+ The {{Gamepad/name}} is intended only as a user-facing identifier.
+ It is not a stable identifier and may change over time due to
+ updates to the device firmware, browser, or operating system.
+
+
index attribute
@@ -659,6 +703,27 @@
Initialize |gamepad|'s {{Gamepad/id}} attribute to an
identification string for the gamepad.
+ If the gamepad has vendor and product identifiers:
+
+ - Initialize |gamepad|.{{Gamepad/vendorId}} to the vendor
+ identifier.
+
+ - Initialize |gamepad|.{{Gamepad/productId}} to the product
+ identifier.
+
+
+
+ Otherwise:
+
+ - Initialize |gamepad|.{{Gamepad/vendorId}} to `null`.
+
+ - Initialize |gamepad|.{{Gamepad/productId}} to `null`.
+
+
+
+ Initialize |gamepad|'s {{Gamepad/name}} attribute to a
+ human-readable identifier for the gamepad.
+
Initialize |gamepad|'s {{Gamepad/index}} attribute to the
result of [=selecting an unused gamepad index=] for |gamepad|.
From a89e1fd5f08b349ed359ddf5f99d610021628707 Mon Sep 17 00:00:00 2001
From: Matt Reynolds
Date: Fri, 10 May 2024 11:38:20 -0700
Subject: [PATCH 2/3] Update index.html
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Marcos Cáceres
---
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/index.html b/index.html
index ab1a371..683abe9 100644
--- a/index.html
+++ b/index.html
@@ -374,7 +374,7 @@
The {{Gamepad/name}} is intended only as a user-facing identifier.
- It is not a stable identifier and may change over time due to
+ It is not a stable identifier and might change over time due to
updates to the device firmware, browser, or operating system.
From 82c1cd414312daa9b8bfe7ad2573f7ef38f9242b Mon Sep 17 00:00:00 2001
From: Matt Reynolds
Date: Fri, 10 May 2024 11:38:27 -0700
Subject: [PATCH 3/3] Update index.html
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Marcos Cáceres
---
index.html | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/index.html b/index.html
index 683abe9..10236b0 100644
--- a/index.html
+++ b/index.html
@@ -703,24 +703,18 @@
Initialize |gamepad|'s {{Gamepad/id}} attribute to an
identification string for the gamepad.
+ Initialize |gamepad|.{{Gamepad/vendorId}} to `null`
+ Initialize |gamepad|.{{Gamepad/productId}} to `null`.
If the gamepad has vendor and product identifiers:
- - Initialize |gamepad|.{{Gamepad/vendorId}} to the vendor
+
- Set |gamepad|.{{Gamepad/vendorId}} to the vendor
identifier.
- - Initialize |gamepad|.{{Gamepad/productId}} to the product
+
- Set |gamepad|.{{Gamepad/productId}} to the product
identifier.
- Otherwise:
-
- - Initialize |gamepad|.{{Gamepad/vendorId}} to `null`.
-
- - Initialize |gamepad|.{{Gamepad/productId}} to `null`.
-
-
-
Initialize |gamepad|'s {{Gamepad/name}} attribute to a
human-readable identifier for the gamepad.