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.
/dev/input/js0)
is not handling the device.input input39: joydev: blacklisting 'Nintendo Co.,
Ltd. Pro Controller (IMU)'absbit and keybit
in order to match a device (defined in joydev_ids
array)absbit and
keybit are 0joycon_input_create, input_register_device
is called BEFORE setting the bits (which happen in joycon_config_*)input_register_device was called
AFTER setting the bitsI 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 !