From d93f9a778b978328a6fcb568c8edad051cccae1b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 7 Sep 2022 12:33:43 -0700
Subject: [PATCH] The new Wii Remote shares the same VID/PID as the Wii U Pro
controller
---
src/joystick/hidapi/SDL_hidapi_wii.c | 13 ++++---------
src/joystick/usb_ids.h | 2 +-
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_wii.c b/src/joystick/hidapi/SDL_hidapi_wii.c
index 09d23bedfbb..77e8ab83b3b 100644
--- a/src/joystick/hidapi/SDL_hidapi_wii.c
+++ b/src/joystick/hidapi/SDL_hidapi_wii.c
@@ -177,10 +177,9 @@ HIDAPI_DriverWii_IsEnabled(void)
static SDL_bool
HIDAPI_DriverWii_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
{
- if (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_WII_PRO) {
- return SDL_TRUE;
- }
- if (vendor_id == USB_VENDOR_NINTENDO && product_id == USB_PRODUCT_NINTENDO_WII_REMOTE) {
+ if (vendor_id == USB_VENDOR_NINTENDO &&
+ (product_id == USB_PRODUCT_NINTENDO_WII_REMOTE ||
+ product_id == USB_PRODUCT_NINTENDO_WII_REMOTE2)) {
return SDL_TRUE;
}
return SDL_FALSE;
@@ -752,11 +751,7 @@ HIDAPI_DriverWii_InitDevice(SDL_HIDAPI_Device *device)
if (device->vendor_id == USB_VENDOR_NINTENDO) {
EWiiExtensionControllerType eExtensionControllerType;
- if (device->product_id == USB_PRODUCT_NINTENDO_WII_PRO) {
- eExtensionControllerType = k_eWiiExtensionControllerType_WiiUPro;
- } else {
- eExtensionControllerType = ReadExtensionControllerType(device);
- }
+ eExtensionControllerType = ReadExtensionControllerType(device);
device->guid.data[15] = eExtensionControllerType;
UpdateDeviceIdentity(device);
}
diff --git a/src/joystick/usb_ids.h b/src/joystick/usb_ids.h
index b650c2e1f5c..b0ce5fe3bdb 100644
--- a/src/joystick/usb_ids.h
+++ b/src/joystick/usb_ids.h
@@ -57,8 +57,8 @@
#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR 0x2008 /* Used by joycond */
#define USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT 0x2007
#define USB_PRODUCT_NINTENDO_SWITCH_PRO 0x2009
-#define USB_PRODUCT_NINTENDO_WII_PRO 0x0330
#define USB_PRODUCT_NINTENDO_WII_REMOTE 0x0306
+#define USB_PRODUCT_NINTENDO_WII_REMOTE2 0x0330
#define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER 0x7214
#define USB_PRODUCT_RAZER_PANTHERA 0x0401
#define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008