Bug 216233 - Nintendo Switch Pro Controller connected with USB, doesn't reconnect after computer resumes from suspend
Summary: Nintendo Switch Pro Controller connected with USB, doesn't reconnect after co...
Status: RESOLVED IMPLEMENTED
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-10 22:57 UTC by tinozzo123
Modified: 2023-11-17 18:51 UTC (History)
0 users

See Also:
Kernel Version: 5.18.9
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Patch to reinitialize the controller after resuming from suspend (6.46 KB, patch)
2023-07-09 22:30 UTC, tinozzo123
Details | Diff
Patch to reinitialize the controller after resuming from suspend (6.56 KB, patch)
2023-07-11 23:01 UTC, tinozzo123
Details | Diff

Description tinozzo123 2022-07-10 22:57:29 UTC
Normally, if you connect a Nintendo Switch Pro Controller (hid-nintendo) via USB, it is automatically connected when turning the computer on.
If however the computer is suspended, when resuming the computer, the controller won't reconnect, even if you press a button. The ways to reconnect it are either:

    Press the sync button on the controller;
    Unplug and plug the USB cable;
    Reboot the computer.


Relevant logs from journalctl when suspending:

lug 11 00:39:44 nixos kernel: nintendo 0003:057E:2009.000F: compensating for 37 dropped IMU reports
lug 11 00:39:44 nixos kernel: nintendo 0003:057E:2009.000F: delta=504 avg_delta=13

When resuming:

lug 11 00:39:44 nixos kernel: leds 0003:057E:2009.000F:green:player-1: Setting an LED's brightness failed (-110)
lug 11 00:39:45 nixos kernel: leds 0003:057E:2009.000F:green:player-2: Setting an LED's brightness failed (-110)
lug 11 00:39:45 nixos kernel: leds 0003:057E:2009.000F:green:player-3: Setting an LED's brightness failed (-110)
lug 11 00:39:46 nixos kernel: leds 0003:057E:2009.000F:green:player-4: Setting an LED's brightness failed (-110)
lug 11 00:39:46 nixos kernel: leds 0003:057E:2009.000F:blue:player-5: Setting an LED's brightness failed (-110)

After pressing the sync button on the controller (still plugged in via USB):

lug 11 00:49:21 nixos kernel: usb 3-2: USB disconnect, device number 17
lug 11 00:49:22 nixos kernel: usb 3-2: new full-speed USB device number 18 using xhci_hcd
lug 11 00:49:22 nixos kernel: usb 3-2: New USB device found, idVendor=057e, idProduct=2009, bcdDevice= 2.10
lug 11 00:49:22 nixos kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
lug 11 00:49:22 nixos kernel: usb 3-2: Product: Pro Controller
...etcetera.
Comment 1 tinozzo123 2023-07-09 22:29:32 UTC
Well, I tried it myself.
After trying to compile the Linux kernel to load a module (first time), I finally did it.
I didn't test it much, but it seems to work well.

If no one has anything against it, I'll send it after a week. (My first kernel contribution)
Comment 2 tinozzo123 2023-07-09 22:30:15 UTC
Created attachment 304579 [details]
Patch to reinitialize the controller after resuming from suspend
Comment 3 tinozzo123 2023-07-11 23:01:09 UTC
Created attachment 304612 [details]
Patch to reinitialize the controller after resuming from suspend
Comment 4 tinozzo123 2023-11-17 18:51:07 UTC
Fixed in Linux 6.6.

Note You need to log in before you can comment on or make changes to this bug.