Fixed Joy-Con type detection for the Nintendo Joy-Con Charging Grip
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 2155a48..0d778a7 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -1983,6 +1983,13 @@ SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
}
+ } else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_GRIP) {
+ if (name && SDL_strstr(name, "(L)") != NULL) {
+ type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT;
+ } else {
+ type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT;
+ }
+
} else if (vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR) {
type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR;