Can't wake up laptop from suspend using external USB keyboard

Cant seem to wake laptop from suspend using external keyboard. Or any external USB devices. Its as if no power on ports while on suspend mode.

OS/Version : Ubuntu 22.04 LTS (same issue on Linux Mint also)

Hardware: Lenovo Ideapad 3 15ALC6 Ub

Kernel version : 6.5.0-14-generic

Description: Cant seem to wake laptop from suspend using external keyboard. Or any external USB devices. Its as if no power on ports while on suspend mode. I would like to keep the lid closed and use just the external monitor.
Same goes for Linux Mint as well. both of them have same kernel version. So I dont think its a specific issue of distro. And I cant figure out where exactly the problem is.

Googled quite a bit and saw lot of similar questiosn. Tried most of the typical solutions available.

  • No option for wake from usb on BIOS
  • keyboard and mouse 's wakeup option is enabled in /sys/bus/usb/devices/1-2/power/wakeup
  • Made it permanent using udev rules (it is enabled after reboot also)
  • Disabled autosuspend using kernel paramters
  • Sleep mode seems to be S3 (if its useful)

Output of grep . /sys/bus/usb/devices/*/power/wakeup

`/sys/bus/usb/devices/1-2/power/wakeup:enabled`
`/sys/bus/usb/devices/3-1/power/wakeup:disabled`
`/sys/bus/usb/devices/3-4/power/wakeup:enabled`
`/sys/bus/usb/devices/usb1/power/wakeup:disabled`
`/sys/bus/usb/devices/usb2/power/wakeup:disabled`
`/sys/bus/usb/devices/usb3/power/wakeup:disabled`
`/sys/bus/usb/devices/usb4/power/wakeup:disabled`

Output of lsusb


`Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub`
`Bus 003 Device 003: ID 0bda:c123 Realtek Semiconductor Corp. Bluetooth Radio`
`Bus 003 Device 042: ID 413c:301a Dell Computer Corp. Dell MS116 Optical Mouse`
`Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub`
`Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub`
`Bus 001 Device 003: ID 04f2:b725 Chicony Electronics Co., Ltd Integrated Camera`
`Bus 001 Device 002: ID 413c:2113 Dell Computer Corp. KB216 Wired Keyboard`
`Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub`

Output of cat /proc/acpi/wakeup

Device	S-state	  Status   Sysfs node
GPP0	  S3	*disabled
GPP1	  S3	*disabled
GPP3	  S3	*disabled
GP17	  S3	*enabled   pci:0000:00:08.1
XHC0	  S3	*enabled   pci:0000:03:00.3
XHC1	  S3	*enabled   pci:0000:03:00.4

Output of inxi -Fxz

System:
  Kernel: 6.5.0-14-generic x86_64 bits: 64 compiler: N/A Desktop: GNOME 42.9
    Distro: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
Machine:
  Type: Laptop System: LENOVO product: 82KU v: IdeaPad 3 15ALC6 Ub
    serial: <superuser required>
  Mobo: LENOVO model: LNVNB161216 v: SDK0T76486WIN
    serial: <superuser required> UEFI: LENOVO v: GLCN52WW date: 12/09/2022
Battery:
  ID-1: BAT0 charge: 37.5 Wh (90.1%) condition: 41.6/45.0 Wh (92.5%)
    volts: 12.0 min: 11.1 model: SMP L20M3PF0 status: Discharging
CPU:
  Info: 6-core model: AMD Ryzen 5 5500U with Radeon Graphics bits: 64
    type: MT MCP arch: Zen 2 rev: 1 cache: L1: 384 KiB L2: 3 MiB L3: 8 MiB
  Speed (MHz): avg: 400 min/max: 400/4056 cores: 1: 400 2: 400 3: 400
    4: 400 5: 400 6: 400 7: 400 8: 400 9: 400 10: 400 11: 400 12: 400
    bogomips: 50305
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
  Device-1: AMD Lucienne vendor: Lenovo driver: amdgpu v: kernel
    bus-ID: 03:00.0
  Device-2: Chicony Integrated Camera type: USB driver: uvcvideo
    bus-ID: 1-3:3
  Display: wayland server: X.Org v: 1.22.1.1 with: Xwayland v: 22.1.1
    compositor: gnome-shell driver: gpu: amdgpu resolution: 1920x1080~75Hz
  OpenGL: renderer: RENOIR (renoir LLVM 15.0.7 DRM 3.54 6.5.0-14-generic)
    v: 4.6 Mesa 23.0.4-0ubuntu1~22.04.1 direct render: Yes
Audio:
  Device-1: AMD Renoir Radeon High Definition Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel bus-ID: 03:00.1
  Device-2: AMD Raven/Raven2/FireFlight/Renoir Audio Processor
    vendor: Lenovo driver: N/A bus-ID: 03:00.5
  Device-3: AMD Family 17h HD Audio vendor: Lenovo driver: snd_hda_intel
    v: kernel bus-ID: 03:00.6
  Sound Server-1: ALSA v: k6.5.0-14-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
    vendor: Lenovo driver: rtw_8822ce v: N/A port: 2000 bus-ID: 01:00.0
  IF: wlp1s0 state: up mac: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
    bus-ID: 3-4:3
  Report: hciconfig ID: hci0 rfk-id: 10 state: up address: <filter>
    bt-v: 3.0 lmp-v: 5.1
Drives:
  Local Storage: total: 476.94 GiB used: 63.02 GiB (13.2%)
  ID-1: /dev/nvme0n1 vendor: Micron model: MTFDHBA512QFD size: 476.94 GiB
    temp: 40.9 C
Partition:
  ID-1: / size: 37.25 GiB used: 15.59 GiB (41.8%) fs: ext4
    dev: /dev/nvme0n1p7
  ID-2: /boot/efi size: 256 MiB used: 46.1 MiB (18.0%) fs: vfat
    dev: /dev/nvme0n1p1
  ID-3: /home size: 65.16 GiB used: 26.99 GiB (41.4%) fs: ext4
    dev: /dev/nvme0n1p8
Swap:
  ID-1: swap-1 type: partition size: 15.26 GiB used: 562.3 MiB (3.6%)
    dev: /dev/nvme0n1p9
Sensors:
  System Temperatures: cpu: N/A mobo: N/A gpu: amdgpu temp: 40.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 354 Uptime: 5h 48m Memory: 5.62 GiB used: 2.74 GiB (48.7%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.4.0 Packages: 2164 Shell: Zsh
  v: 5.8.1 inxi: 3.3.13

Iā€™m not sure what else is to be provided, but just ask for what is needed and I can update it.

External keyboard wakesup if lid is open while suspending. The problem is only when lid is closed

Note: Something that I noticed is that if i ā€œenableā€ power/wakeup of usb1, it works but then I cant suspend as webcam is part of usb1 . So just as I suspend the laptop, it turns back on.

Hi @viswajith.j.official .
Welcome to itsFOSS community.

There is a configuration file /etc/systemd/logind.conf
If you look in that file you will find

....
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
...

Note they will be commented out.
I think you may need to edit that file and change one or more of those lines

  • remove the ā€˜#ā€™
  • change the value to ā€˜ignoreā€™ or ā€˜noneā€™ or something
    check the man page
    man logind.conf
    on your system.

Regards
Neville

5 Likes

Thank you for your reply. But I would like to suspend my laptop on closing lid when external monitors are not connected. So I dont want to ā€˜ignoreā€™ the lid switch (I guess thatā€™s what this option does)
I need to wakeup the laptop from suspend mode(lid closed) using external keyboard
My guess is, if USB port can be powered during suspend, this would work.

Edit: After typing out this reply, I tried that anyway. But didnt work. Still cant wakeup using usb keyboard.

1 Like

Sorry, do not see how you can do thatā€¦ maybe you could try hibernate instead of suspend.
Someone else may know.

1 Like

@viswajith.j.official
This seems to tell you how to do it

https://www.kernel.org/doc/html/v4.13/driver-api/usb/persist.html

1 Like

Value of persist file is already set to 1 in all devices. At this point I kind of enabled all the options concerned with this issue. Could there be any higher priority setting that overrides and renders all of this options void ?
Thank you for your time btw :slight_smile:

So that says the power is on to the usb devices?
Can you test any way to see if they are powered? eg plug a lamp into the usb?

I dont think anything can override the kernelā€¦ it is in charge.

Appreciated

1 Like

Maybe something to do with wake_interrupts for the usb device

https://docs.kernel.org/power/suspend-and-interrupts.html

and
look at /proc/acpi/wakeup

and
look at udev rules for usb device.

ā€œA udev rule can be useful to enable the wakeup triggers of a USB device, like a mouse or a keyboard, so that it can be used to wake the system from sleep. Note: By default, the USB host controllers are all enabled for wakeup. The status can be checked using cat /proc/acpi/wakeup .ā€

https://wiki.archlinux.org/title/udev

2 Likes

Tried charging my phone. Didnā€™t work

This goes deep into the programming of how its implemented. I couldnā€™t derive any actionable steps from it.

I have already provided the output of /proc/acpi/wakeup (though Iā€™m not entirely sure what to make of it.)

As I have mentioned in question, I have tried creating the udev rule to permanently enable wakeup option for the corresponding usb port. I will update it with the rule I made
Edit: Canā€™t seem to edit the question. I will update the udev rule here
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", ATTRS{idProduct}=="2113", RUN+="/bin/sh -c 'echo enabled > /sys/bus/usb/devices/1-2/power/wakeup'"

I can say that it works because the wakeup file is enabled permenantly now. It just doesnt reflect in actions.

(Sorry for late replies. Had an exam today :slight_smile: )

2 Likes

Hope it goes well

I assume that is the usb kb and mouse not the inbuilt ones?

Sorry I missed some of your info.
I am running out of ideas.

1 Like

Thanks, it was fine :slight_smile:

Its the usb keyboard. Could verify from output of lsusb

Its fine bro. Its probably an hardware limitation of my laptop. I asked in their forums and they also didnā€™t provide a definite method to verify it.

There may be kernel boot parameter that you can setā€¦
something which would enable suspended kernel to resoond to interrupts
but
how is suspended kernel going to receive an interrupt if the usb port has no power?
I cant answer that?

1 Like

Basically the question is if the laptop USB ports are powered with the lid closed and no external monitors. The USB Keyboard / mouse must have power to work, so no power means no wakeupā€¦ This may be a BIOS setting question, or something in software, but Iā€™d be more inclined to suspect the hardware / BIOS.

If you boot the machine with that evil company O/S, does it to the same thing? If it does then it is more likely to be a hardware issue than anything in the O/S

ex-Gooserider

2 Likes

Yes it has the same issue. But I havenā€™t tweaked much in its settings as I dont use it. Seeing wakeup options in Linux gave me hope that it might work. But unfortunately it doesnā€™t. It is a hardware issue I think. BIOS not having the option everybodyā€™s talking about also points to that conclusion.

@viswajith.j.official ,
If you were successful, there remains the issue of whether it
is a good idea to run a laptop with the lid closed.
Some laptops depend on the lid being open for proper heat
dissapation.

2 Likes