@Schuay asked for a revert: see [here](https://github.com/Ryubing/Issues/issues/394#issuecomment-4359848762)

revert Disable SDL3 HIDAPI Switch driver when hid_nintendo is loaded

On Linux, the hid_nintendo kernel module creates separate evdev
devices for gamepad input and IMU (motion sensors), which SDL3's
evdev backend properly combines. When HIDAPI is active instead, it
conflicts with the kernel driver, breaking motion/gyro input and
controller hotplugging (especially via wireless dongles).

Automatically detect hid_nintendo via /sys/module and fall back to
the evdev backend. Can still be overridden with the env var
SDL_JOYSTICK_HIDAPI_SWITCH=1.

Reviewed-on: https://git.ryujinx.app/projects/Ryubing/pulls/46
This commit is contained in:
sh0inx
2026-05-02 01:03:53 +00:00
committed by sh0inx
parent 51d0d888fb
commit 2a4eb8c529

View File

@@ -61,14 +61,6 @@ namespace Ryujinx.SDL3.Common
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
SDL_SetHint(SDL_HINT_VIDEO_ALLOW_SCREENSAVER, "1");
// When hid_nintendo is loaded, it creates separate evdev devices for the gamepad
// and IMU which SDL3's evdev backend combines via UNIQ matching. Using HIDAPI
// instead conflicts with the kernel driver and breaks motion and hotplug.
if (OperatingSystem.IsLinux() && Directory.Exists("/sys/module/hid_nintendo"))
{
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_SWITCH, "0");
}
// NOTE: As of SDL3 2.24.0, joycons are combined by default but the motion source only come from one of them.
// We disable this behavior for now.
SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_COMBINE_JOY_CONS, "0");