diff --git a/include/SDL_hints.h b/include/SDL_hints.h index 78173c39a..bacfe1740 100644 --- a/include/SDL_hints.h +++ b/include/SDL_hints.h @@ -696,6 +696,15 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" +/** + * \brief A variable controlling whether the Home button LED should be turned on when a Nintendo Switch controller is opened + * + * This variable can be set to the following values: + * "0" - home button LED is left off + * "1" - home button LED is turned on (the default) + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED "SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED" + /** * \brief A variable controlling whether Switch Joy-Cons should be treated the same as Switch Pro Controllers when using the HIDAPI driver. * diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c index 213344f65..8a65853b6 100644 --- a/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/src/joystick/hidapi/SDL_hidapi_switch.c @@ -876,7 +876,11 @@ HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joysti /* Set the LED state */ if (ctx->m_bHasHomeLED) { - SetHomeLED(ctx, 100); + if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, SDL_TRUE)) { + SetHomeLED(ctx, 100); + } else { + SetHomeLED(ctx, 0); + } } SetSlotLED(ctx, (joystick->instance_id % 4));