SDL: Fix the 8BitDo Ultimate 2D Wireless Controller showing up multiple times (17eb2)

From 17eb20505c550161b4bd704fc24b2b9cb1b5ef0b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 9 Feb 2026 13:28:04 -0800
Subject: [PATCH] Fix the 8BitDo Ultimate 2D Wireless Controller showing up
 multiple times

This controller has 3 interfaces, one for the Xbox gamepad protocol, and two HID interfaces. We should only handle the Xbox interface in the Xbox driver.

(cherry picked from commit 9f8c70713a13f3bb05415f7a40b0dc501f936129)
---
 src/joystick/hidapi/SDL_hidapi_xboxone.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/joystick/hidapi/SDL_hidapi_xboxone.c b/src/joystick/hidapi/SDL_hidapi_xboxone.c
index 11e7f574cece3..c42c708ba5405 100644
--- a/src/joystick/hidapi/SDL_hidapi_xboxone.c
+++ b/src/joystick/hidapi/SDL_hidapi_xboxone.c
@@ -357,6 +357,10 @@ static bool HIDAPI_DriverXboxOne_IsEnabled(void)
 
 static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GamepadType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
 {
+    static const int LIBUSB_CLASS_VENDOR_SPEC = 0xFF;
+    static const int XBONE_IFACE_SUBCLASS = 71;
+    static const int XBONE_IFACE_PROTOCOL = 208;
+
 #if defined(SDL_PLATFORM_MACOS) && defined(SDL_JOYSTICK_MFI)
     if (!SDL_IsJoystickBluetoothXboxOne(vendor_id, product_id)) {
         // On macOS we get a shortened version of the real report and
@@ -365,6 +369,13 @@ static bool HIDAPI_DriverXboxOne_IsSupportedDevice(SDL_HIDAPI_Device *device, co
         return false;
     }
 #endif
+    if (interface_class &&
+        (interface_class != LIBUSB_CLASS_VENDOR_SPEC ||
+         interface_subclass != XBONE_IFACE_SUBCLASS ||
+         interface_protocol != XBONE_IFACE_PROTOCOL)) {
+        // This isn't the Xbox gamepad interface
+        return false;
+    }
     return (type == SDL_GAMEPAD_TYPE_XBOXONE);
 }