[Bug][Patch] /dev/input/jsX absent for Nintendo Switch Pro controller
From: Tom Benham <hidden>
Date: 2025-08-16 18:24:13
Also in:
lkml
First and foremost, apologies if this report is not properly done or formatted or whatever regarding the kernel development process. Feel free to correct me if I did something wrong.
Distribution: ArchLinux
|$ cat /proc/version
Linux version 6.16-arch2-1 (linux@archlinux) (gcc (GCC) 15.2.1 20250813, GNU ld (GNU Binutils) 2.45.0) #3 SMP PREEMPT_DYNAMIC Sat, 16 Aug 2025 16:19:12 +0000
|
Problem description:
When plugging a Nintendo Switch Pro controller, the |/dev/input/js0| file does not get created.
Problem analysis:
I think I have pinpointed the bug in the hid-nintendo.c driver.
* joydev (who is responsible for creating |/dev/input/js0|) is not
handling the device.
* However, joydev receives the handling request from input.c only for
the IMU device (the accelerometer), which is blacklisted (totally
normal) so we get the following message when activating debug
messages in joydev:
o |input input39: joydev: blacklisting 'Nintendo Co., Ltd. Pro
Controller (IMU)'|
* joydev is looking for |absbit| and |keybit| in order to match a
device (defined in |joydev_ids| array)
* But for the regular device (not IMU), |absbit| and |keybit| are 0
* The reason is that in |joycon_input_create|, |input_register_device|
is called BEFORE setting the bits (which happen in |joycon_config_*|)
* This change was introduced in commit
94f18bb19945915fcdfd1903841020ef1b6af44a
* Before that, |input_register_device| was called AFTER setting the bits
* So, possible regression ? I can't test with older kernels unfortunately
I attached the simple patch that works for me.
Would it also make sense to move the rumble config before the call to |input_register_device| ? It was moved after the IMU device creation in the same commit, although I am not sure if it NEEDS to be. Let me know what you think of that.
Unrelated to the bug but I noticed during my testing that when first plugging the controller, when the hid_nintendo module is not loaded, hid-generic handles it but then it gets disconnected right after and hid_nintendo takes over. I'm very new to kernel debugging so I don't know if this behavior is normal but I guess it is. What's funny is that because hid-generic doesn't have the same bug, the |/dev/input/js0| device gets created and then immediately removed. You can see it if you |ls| continuously the |/dev/input| folder. This was very confusing at first ! Attachments
- hid_nintendo.patch [text/x-patch] 861 bytes · preview