Commit 45f143754946744e4c93a547b0969e26ba4afb62

Sam Lantinga 2020-11-18T20:34:12

Experimenting with requesting the serial number on an Xbox One controller

diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index 2fbd685..9443e52 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -72,6 +72,13 @@ static const Uint8 xboxone_init5[] = {
     0x00, 0x00, 0xFF, 0x00, 0xEB
 };
 
+#ifdef REQUEST_SERIAL_NUMBER
+/* Request serial number */
+static const Uint8 xboxone_init_serial[] = {
+    0x1E, 0x30, 0x07, 0x01, 0x04
+};
+#endif
+
 /*
  * This specifies the selection of init packets that a gamepad
  * will be sent on init *and* the order in which they will be
@@ -100,6 +107,10 @@ static const SDL_DriverXboxOne_InitPacket xboxone_init_packets[] = {
      */
     { 0x0000, 0x0000, 0x045e, 0x0000, xboxone_init4, sizeof(xboxone_init4), { 0x00, 0x00 } },
     { 0x0000, 0x0000, 0x045e, 0x0000, xboxone_init5, sizeof(xboxone_init5), { 0x00, 0x00 } },
+
+#ifdef REQUEST_SERIAL_NUMBER
+    { 0x0000, 0x0000, 0x0000, 0x0000, xboxone_init_serial, sizeof(xboxone_init_serial), { 0x00, 0x00 } },
+#endif
 };
 
 typedef enum {