SDL: SInput Serial from MAC

From 46ea7aa80eade24eebd9f9a5be6da3ce916dd6ff Mon Sep 17 00:00:00 2001
From: Mitch Cairns <[EMAIL REDACTED]>
Date: Thu, 17 Jul 2025 21:11:49 -0700
Subject: [PATCH] SInput Serial from MAC

---
 src/joystick/hidapi/SDL_hidapi_sinput.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/joystick/hidapi/SDL_hidapi_sinput.c b/src/joystick/hidapi/SDL_hidapi_sinput.c
index bc4aa79845e26..9c4e827447ae8 100644
--- a/src/joystick/hidapi/SDL_hidapi_sinput.c
+++ b/src/joystick/hidapi/SDL_hidapi_sinput.c
@@ -313,6 +313,15 @@ static void ProcessSDLFeaturesResponse(SDL_HIDAPI_Device *device, Uint8 *data)
     ctx->touchpad_count = data[16];
     ctx->touchpad_finger_count = data[17];
 
+    // Get device Serial - MAC address
+    char serial[18];
+    (void)SDL_snprintf(serial, sizeof(serial), "%.2x-%.2x-%.2x-%.2x-%.2x-%.2x",
+                       data[23], data[22], data[21], data[20], data[19], data[18]);
+#if defined(DEBUG_SINPUT_INIT)
+    SDL_Log("Serial num: %s", serial);
+#endif
+    HIDAPI_SetDeviceSerial(device, serial);
+
 #if defined(DEBUG_SINPUT_INIT)
     SDL_Log("Accelerometer Range: %d", ctx->accelRange);
 #endif