Wakeup from suspend using USB devices (wireless keyboard, Infrared remote)

Hi community,

I want to wake up my computer from S3 sleep using USB devices. I have the Logitech Unifying Receiver plugged into a USB port and a keyboard and a mouse paired to it. By default, my Manjaro doesn't wake from suspend when I press anything on the wireless keyboard. The power button on the computer works though.

# grep . /sys/bus/usb/devices/*/power/wakeup # <-------- This is by default.

# echo enabled > /sys/bus/usb/devices/usb2/power/wakeup # <-------- Then I enable waking on USB2...

# grep . /sys/bus/usb/devices/*/power/wakeup # <------- ... which gives this.

Now, if I systemctl suspend, the system goes to sleep and wakes up immediately !

I checked if the keyboard is not sending stuff continuously (like broken key) with xev, and it is not. No keypress -> no xev event.

Then I looked at the output of dmesg dmesg or journalctl -e (which includes dmesg). No reason whatsoever given for the wakeup !

[ 2539.136895] PM: suspend entry (deep)
[ 2539.136896] PM: Syncing filesystems ... done.
[ 2539.405262] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 2539.407167] OOM killer disabled.
[ 2539.407167] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2539.408248] Suspending console(s) (use no_console_suspend to debug)
[ 2539.409135] sd 1:0:0:0: [sda] Synchronizing SCSI cache
[ 2539.409881] sd 1:0:0:0: [sda] Stopping disk
[ 2539.682515] ACPI: Preparing to enter system sleep state S3
[ 2539.705197] PM: Saving platform NVS memory
[ 2539.705409] Disabling non-boot CPUs ...
[ 2539.734110] smpboot: CPU 1 is now offline
[ 2539.764034] smpboot: CPU 2 is now offline
[ 2539.802958] smpboot: CPU 3 is now offline
[ 2539.807382] ACPI: Low-level resume complete
[ 2539.807476] PM: Restoring platform NVS memory
[ 2539.817847] Enabling non-boot CPUs ...
[ 2539.817897] x86: Booting SMP configuration:
[ 2539.817899] smpboot: Booting Node 0 Processor 1 APIC 0x2
[ 2539.821223]  cache: parent cpu1 should not be sleeping
[ 2539.821484] CPU1 is up
[ 2539.821516] smpboot: Booting Node 0 Processor 2 APIC 0x1
[ 2539.822466]  cache: parent cpu2 should not be sleeping
[ 2539.822681] CPU2 is up
[ 2539.822705] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 2539.823481]  cache: parent cpu3 should not be sleeping
[ 2539.823855] CPU3 is up
[ 2539.834825] ACPI: Waking up from system sleep state S3
[ 2539.871892] rtc_cmos 00:02: Alarms can be up to one month in the future
[ 2539.883574] iwlwifi 0000:04:00.0: Radio type=0x1-0x2-0x0
[ 2539.886609] sd 1:0:0:0: [sda] Starting disk
[ 2539.985708] usb 3-3: Disable of device-initiated U1 failed.
[ 2539.989235] usb 3-3: Disable of device-initiated U2 failed.
[ 2540.006719] iwlwifi 0000:04:00.0: Radio type=0x1-0x2-0x0
[ 2540.112747] usb 3-3: reset SuperSpeed USB device number 2 using xhci_hcd
[ 2540.186881] ata2: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 2540.187525] ata2.00: supports DRM functions and may not be fully accessible
[ 2540.192532] ata2.00: supports DRM functions and may not be fully accessible
[ 2540.196095] ata2.00: configured for UDMA/133
[ 2540.206267] ahci 0000:00:1f.2: port does not support device sleep
[ 2540.206354] ata2.00: Enabling discard_zeroes_data
[ 2540.252659] usb 2-7: reset high-speed USB device number 4 using xhci_hcd
[ 2540.515979] usb 2-4: reset high-speed USB device number 7 using xhci_hcd
[ 2540.779312] usb 2-8: reset high-speed USB device number 5 using xhci_hcd
[ 2540.999229] usb 2-7.1: reset full-speed USB device number 6 using xhci_hcd
[ 2541.150106] OOM killer enabled.
[ 2541.150108] Restarting tasks ... 
[ 2541.151173] pci_bus 0000:01: Allocating resources
[ 2541.151202] pci_bus 0000:02: Allocating resources
[ 2541.151231] pci_bus 0000:03: Allocating resources
[ 2541.151258] pci_bus 0000:04: Allocating resources
[ 2541.152024] pci_bus 0000:01: Allocating resources
[ 2541.152047] pci_bus 0000:02: Allocating resources
[ 2541.152075] pci_bus 0000:03: Allocating resources
[ 2541.152104] pci_bus 0000:04: Allocating resources
[ 2541.158398] done.
[ 2541.159077] video LNXVIDEO:00: Restoring backlight state
[ 2541.159079] PM: suspend exit
[ 2541.188138] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready
[ 2541.326902] r8169 0000:02:00.0 enp2s0: link down
[ 2541.326986] IPv6: ADDRCONF(NETDEV_UP): enp2s0: link is not ready
[ 2541.330411] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[ 2541.460250] r8169 0000:03:00.0 enp3s0: link down
[ 2541.460319] IPv6: ADDRCONF(NETDEV_UP): enp3s0: link is not ready
[ 2541.463025] IPv6: ADDRCONF(NETDEV_UP): wlp4s0: link is not ready
[ 2543.388282] r8169 0000:02:00.0 enp2s0: link up
[ 2543.388290] IPv6: ADDRCONF(NETDEV_CHANGE): enp2s0: link becomes ready
[ 2543.575722] r8169 0000:03:00.0 enp3s0: link up
[ 2543.575730] IPv6: ADDRCONF(NETDEV_CHANGE): enp3s0: link becomes ready

Then I looked up some Ubuntu forums suggesting to unload xhci_hcd module. But I can't possibly do that. I want to use my USB's as USB 3.0, it's against the purpose. And even more than that, trying to removing it gives this:

# rmmod xhci_hcd
rmmod: ERROR: Module xhci_hcd is in use by: xhci_pci

I removed then xhci_pci which resulted in me not being able to use my USB keyboard :rofl: so I had to reboot. This is a dead end.

I need a way to wake up from sleep from USB devices.
But before that, I need to know WHY my computer wakes up from suspend immediately after entering in suspend.

Help greatly appreciated !

We will need more information to assist you in resolving your issue.

inxi -Fxxxz       

Please post the input/outputs of all requested commands.

Information on how to post hardware specs and logs on the forum:

I have tried to help on this issue before. I thought there might be a way to workaround this issue with a systemd service and scripting. Unfortunately there wasn't any real progress using that method. Perhaps others have ideas on a different approach.

Here is a link with a similar type issue:

See the bottom of this thread, it turns out to be a Gnome extension issue in that case, would not hurt to check it out.

On my computer I needed to go in S1 sleep not S3 to achieve power to USB's while sleeping.
I had to activate a setting in BIOS that let's the OS to choose between S1 and S3 (only S3 was available in the default BIOS setting).
Prior to activating that BIOS feature, my /sys/power/mem_sleep had only this:

$ cat /sys/power/mem_sleep
s2idle [deep]

After activating it, I was able to select the shallow default.

$ cat /sys/power/mem_sleep
s2idle [shallow] deep

Shallow corresponds to S1 and is obviously less deep than S3. You can see that by looking at the dmesg output in both cases - S3 turns off more stuff.
Found all I needed to understand this in the kernel documentation.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by