Skip to content

Instantly share code, notes, and snippets.

@segevfiner
Created June 22, 2024 07:57
Show Gist options
  • Save segevfiner/27558d5ba6ff2afeba07da656d531122 to your computer and use it in GitHub Desktop.
Save segevfiner/27558d5ba6ff2afeba07da656d531122 to your computer and use it in GitHub Desktop.
Turn off Switch Pro Controller Home LED
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "pysdl2",
# "pysdl2-dll",
# ]
# ///
"""
Old versions of SDL2 used to turn on the Switch Pro Controller home LED, which is often
undersirable, this script will turn it off.
"""
import sdl2
sdl2.SDL_SetHint(
sdl2.SDL_HINT_JOYSTICK_HIDAPI_SWITCH_HOME_LED, str(0).encode())
sdl2.SDL_Init(sdl2.SDL_INIT_GAMECONTROLLER)
controller = sdl2.SDL_GameControllerOpen(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment