From 1af31a26d180e8c92610f2abd90e8581f59cf4e5 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 27 Feb 2020 13:53:32 -0800 Subject: [PATCH] Fixed trying to handle the HORI Wireless Switch Pad when connected via USB --- src/joystick/hidapi/SDL_hidapi_switch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 29a05bfa498f2..302d89c5431e7 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -245,6 +245,15 @@ static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id) static SDL_bool HIDAPI_DriverSwitch_IsSupportedDevice(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) { + /* The HORI Wireless Switch Pad enumerates as a HID device when connected via USB + with the same VID/PID as when connected over Bluetooth but doesn't actually + support communication over USB. The most reliable way to block this without allowing the + controller to continually attempt to reconnect is to filter it out by manufactuer/product string. + Note that the controller does have a different product string when connected over Bluetooth. + */ + if (SDL_strcmp( name, "HORI Wireless Switch Pad" ) == 0) { + return SDL_FALSE; + } return (type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO); }