From 77a5796d43c574d399d42b7a3d1d0c2acb6500d1 Mon Sep 17 00:00:00 2001 From: schuay <36006+schuay@users.noreply.github.com> Date: Sun, 22 Mar 2026 11:15:11 +0100 Subject: [PATCH] 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. --- src/Ryujinx.SDL3.Common/SDL3Driver.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Ryujinx.SDL3.Common/SDL3Driver.cs b/src/Ryujinx.SDL3.Common/SDL3Driver.cs index 529a846e0..557c461c5 100644 --- a/src/Ryujinx.SDL3.Common/SDL3Driver.cs +++ b/src/Ryujinx.SDL3.Common/SDL3Driver.cs @@ -61,6 +61,14 @@ 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");