SDL
SDL copied to clipboard
Failure to detect Xbox Series Controller inputs after reconnection
On Arch Linux, using the xpadneo driver and the controller connected via Bluetooth, whenever the controller disconnects and reconnects, inputs stop being registered in any SDL application. The only way to get it working again is to either connect it via cable or to fully restart the PC. It works as expected on the first connection only.
Applications that use other controller interfaces, like evdev, continue working correctly after reconnection, so it doesn't look like it's a driver issue. It happens both in SDL3 applications and SDL2 applications using SDL2 Compat.
Running testcontroller.c produces the following output upon connection, disconnection, and reconnection:
Using udev for HIDAPI joystick device discovery
Using udev for joystick device discovery
HIDAPI_SetupDeviceDriver() couldn't open /dev/hidraw6: Failed to open a device with path '/dev/hidraw6': Permission denied
Added HIDAPI device 'Xbox 360 Controller' VID 0x045e, PID 0x028e, bluetooth 1, version 0, serial 3c:fa:06:00:c5:f3, interface -1, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0005, path = /dev/hidraw6, driver = NONE (DISABLED)
Gamepad 5 added
Opened gamepad Xbox 360 Controller, guid 050018dc5e0400008e02000030110000, /dev/input/event25
Rumble supported
Player index: 0
Mapping: 050018dc5e0400008e02000030110000,Xbox 360 Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,crc:dc18,platform:Linux,
Gamepad 5 removed
Removing HIDAPI device 'Xbox 360 Controller' VID 0x045e, PID 0x028e, bluetooth 1, version 0, serial 3c:fa:06:00:c5:f3, interface -1, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0005, path = /dev/hidraw6, driver = NONE (DISABLED)
Added HIDAPI device 'Xbox 360 Controller' VID 0x045e, PID 0x028e, bluetooth 1, version 0, serial 3c:fa:06:00:c5:f3, interface -1, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0005, path = /dev/hidraw6, driver = SDL_JOYSTICK_HIDAPI_XBOX_360 (ENABLED)
Gamepad 6 added
Opened gamepad Xbox 360 Controller, guid 050018dc5e0400008e02000000006800, /dev/hidraw6
Has player LED
Rumble supported
Player index: 0
Mapping: 050018dc5e0400008e02000000006800,*,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,crc:dc18,platform:Linux,
Gamepad 6 removed
Removing HIDAPI device 'Xbox 360 Controller' VID 0x045e, PID 0x028e, bluetooth 1, version 0, serial 3c:fa:06:00:c5:f3, interface -1, interface_class 0, interface_subclass 0, interface_protocol 0, usage page 0x0001, usage 0x0005, path = /dev/hidraw6, driver = SDL_JOYSTICK_HIDAPI_XBOX_360 (ENABLED)
Inputs are detected correctly upon the first connection, but on reconnection the controller is totally unresponsive.