lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <afab2e44-ff31-4b3f-bfd8-0d5b184423c4@free.fr>
Date: Sat, 16 Aug 2025 20:24:10 +0200
From: Tom Benham <tomben13@...e.fr>
To: linux-input@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [Bug][Patch] /dev/input/jsX absent for Nintendo Switch Pro controller

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@...hlinux) (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 !

Content of type "text/html" skipped

View attachment "hid_nintendo.patch" of type "text/x-patch" (861 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ