I’ve confirmed the behavior with btmon
. Steam is disabling motion reporting on the controller via Bluetooth the moment the game window is focued
So my current workaround it to have a python script that re-enables the motion reporting on the controller and make it run every 1 second. Add these two files somewhere:
-
pip install pysdl2
-
sdl-enable.py:
import sys
import sdl2
import sdl2.ext
import time
def enable_motion(controller):
if sdl2.SDL_GameControllerSetSensorEnabled(controller, sdl2.SDL_SENSOR_ACCEL, 1) != 0:
print(f"Failed to enable accelerometer: {sdl2.SDL_GetError().decode()}")
sdl2.SDL_GameControllerClose(controller)
sdl2.SDL_Quit()
def main():
if sdl2.SDL_Init(sdl2.SDL_INIT_GAMECONTROLLER | sdl2.SDL_INIT_EVENTS) != 0:
print(f"SDL_Init error: {sdl2.SDL_GetError().decode()}")
return 1
num_joysticks = sdl2.SDL_NumJoysticks()
for i in range(num_joysticks):
if sdl2.SDL_IsGameController(i):
controller = sdl2.SDL_GameControllerOpen(i)
if controller:
enable_motion(controller)
if __name__ == "__main__":
sys.exit(main())
- fix-motion.sh
#!/bin/bash
while true; do python /home/kuba/sdl-enable.py; sleep 1; done &
"$@"
Then, run chmod +x fix-motion.sh
and change the steam command to /path/to/fix-motion.sh %command%