Skip to content

Commit

Permalink
Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly v…
Browse files Browse the repository at this point in the history
…ia 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.
  • Loading branch information
slouken committed Mar 21, 2020
1 parent 269f821 commit 106ffd5
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/joystick/hidapi/SDL_hidapi_switch.c
Expand Up @@ -226,7 +226,24 @@ typedef struct {
} SDL_DriverSwitch_Context;


static SDL_bool IsGameCubeFormFactor(int vendor_id, int product_id)
static SDL_bool
HasHomeLED(int vendor_id, int product_id)
{
/* The Power A Nintendo Switch Pro controllers don't have a Home LED */
if (vendor_id == 0 && product_id == 0) {
return SDL_FALSE;
}

/* HORI Wireless Switch Pad */
if (vendor_id == 0x0f0d && product_id == 0x00f6) {
return SDL_FALSE;
}

return SDL_TRUE;
}

static SDL_bool
IsGameCubeFormFactor(int vendor_id, int product_id)
{
static Uint32 gamecube_formfactor[] = {
MAKE_VIDPID(0x0e6f, 0x0185), /* PDP Wired Fight Pad Pro for Nintendo Switch */
Expand Down Expand Up @@ -708,8 +725,7 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti
/* Find out whether or not we can send output reports */
ctx->m_bInputOnly = SDL_IsJoystickNintendoSwitchProInputOnly(device->vendor_id, device->product_id);
if (!ctx->m_bInputOnly) {
/* The Power A Nintendo Switch Pro controllers don't have a Home LED */
ctx->m_bHasHomeLED = (device->vendor_id != 0 && device->product_id != 0) ? SDL_TRUE : SDL_FALSE;
ctx->m_bHasHomeLED = HasHomeLED(device->vendor_id, device->product_id);

/* Initialize rumble data */
SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]);
Expand Down

0 comments on commit 106ffd5

Please sign in to comment.