Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly via Bluetooth
authorSam Lantinga <slouken@libsdl.org>
Fri, 20 Mar 2020 20:45:30 -0700
changeset 136596814f6645eb2
parent 13658 4370d30702d5
child 13660 25927a14e406
Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly via Bluetooth

bluenaxela+sdl

The HORI Wireless Switch Pad does not properly connect via bluetooth. I did some debugging and found that the code that tries to control the Home LED causes this controller to disconnect.
src/joystick/hidapi/SDL_hidapi_switch.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapi_switch.c	Fri Mar 20 20:40:14 2020 -0700
     1.2 +++ b/src/joystick/hidapi/SDL_hidapi_switch.c	Fri Mar 20 20:45:30 2020 -0700
     1.3 @@ -226,7 +226,24 @@
     1.4  } SDL_DriverSwitch_Context;
     1.5  
     1.6  
     1.7 -static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id)
     1.8 +static SDL_bool
     1.9 +HasHomeLED(int vendor_id, int product_id)
    1.10 +{
    1.11 +	/* The Power A Nintendo Switch Pro controllers don't have a Home LED */
    1.12 +	if (vendor_id == 0 && product_id == 0) {
    1.13 +		return SDL_FALSE;
    1.14 +	}
    1.15 +
    1.16 +	/* HORI Wireless Switch Pad */
    1.17 +	if (vendor_id == 0x0f0d && product_id == 0x00f6) {
    1.18 +		return SDL_FALSE;
    1.19 +	}
    1.20 +
    1.21 +	return SDL_TRUE;
    1.22 +}
    1.23 +
    1.24 +static SDL_bool
    1.25 +IsGameCubeFormFactor(int vendor_id, int product_id)
    1.26  {
    1.27      static Uint32 gamecube_formfactor[] = {
    1.28          MAKE_VIDPID(0x0e6f, 0x0185),    /* PDP Wired Fight Pad Pro for Nintendo Switch */
    1.29 @@ -708,8 +725,7 @@
    1.30      /* Find out whether or not we can send output reports */
    1.31      ctx->m_bInputOnly = SDL_IsJoystickNintendoSwitchProInputOnly(device->vendor_id, device->product_id);
    1.32      if (!ctx->m_bInputOnly) {
    1.33 -        /* The Power A Nintendo Switch Pro controllers don't have a Home LED */
    1.34 -        ctx->m_bHasHomeLED = (device->vendor_id != 0 && device->product_id != 0) ? SDL_TRUE : SDL_FALSE;
    1.35 +        ctx->m_bHasHomeLED = HasHomeLED(device->vendor_id, device->product_id);
    1.36  
    1.37          /* Initialize rumble data */
    1.38          SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]);