Fixed trying to handle the HORI Wireless Switch Pad when connected via USB
authorSam Lantinga <slouken@libsdl.org>
Thu, 27 Feb 2020 13:53:32 -0800
changeset 13558ed7c27865ea7
parent 13557 0e9384077170
child 13559 61b564f66050
Fixed trying to handle the HORI Wireless Switch Pad when connected via USB
src/joystick/hidapi/SDL_hidapi_switch.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapi_switch.c	Thu Feb 27 09:33:32 2020 -0800
     1.2 +++ b/src/joystick/hidapi/SDL_hidapi_switch.c	Thu Feb 27 13:53:32 2020 -0800
     1.3 @@ -245,6 +245,15 @@
     1.4  static SDL_bool
     1.5  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)
     1.6  {
     1.7 +    /* The HORI Wireless Switch Pad enumerates as a HID device when connected via USB
     1.8 +       with the same VID/PID as when connected over Bluetooth but doesn't actually
     1.9 +       support communication over USB. The most reliable way to block this without allowing the
    1.10 +       controller to continually attempt to reconnect is to filter it out by manufactuer/product string.
    1.11 +       Note that the controller does have a different product string when connected over Bluetooth.
    1.12 +     */
    1.13 +    if (SDL_strcmp( name, "HORI Wireless Switch Pad" ) == 0) {
    1.14 +        return SDL_FALSE;
    1.15 +    }
    1.16      return (type == SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO);
    1.17  }
    1.18