My external keyboard does not have a suspend button. Is there a way I can set up Ubuntu to use a different key (or any key for that matter) to wake the PC if it has been suspended?
2 Answers
If you run the following command, you will see a list of USB devices and if they are enabled to wake up the system.
cat /proc/acpi/wakeup
You will see a list of items such as the the one seen below.
USB0 S3 *disabled pci:0000:00:12.0
Once you have established which device is the keyboard, let’s say USB0, run this command.
sudo su
echo USB0 > /proc/acpi/wakeup
Now, if you run the command from the start again, you should see enabled next to the device.
USB0 S3 *enabled pci:0000:00:12.0
That worked for me, and I can wake up my desktop with any key.
Details on the wakeup codes for devices can be found here (link courtesy of Santhana Krishnan).
- 854
- 3,227
Another thing that may need to be checked is /sys/bus/usb/devices/*/power/wakeup.
For example on my machine
[~]$ ls /sys/bus/usb/devices
1-0:1.0 1-1:1.0 2-1 2-1:1.1 2-3:1.0 2-7:1.0 2-8 2-8:1.1 usb1 usb3
1-1 2-0:1.0 2-1:1.0 2-3 2-7 2-7:1.1 2-8:1.0 3-0:1.0 usb2
This lists the devices. To view which folder name (? what is this called) correspond to which device you can
[devices]$ lsusb
...
Bus 002 Device 023: ID feed:abcd Andrew Hess starboard
...
which appears to correspond to
[~]$ cat /sys/bus/usb/devices/2-1/idVendor
feed
[~]$ cat /sys/bus/usb/devices/2-1/idProduct
abcd
[~]$ cat /sys/bus/usb/devices/2-1/manufacturer
Andrew Hess
[~]$ cat /sys/bus/usb/devices/2-1/product
starboard
then you need to check
[~]$ cat /sys/bus/usb/devices/2-1/power/wakeup
enabled
Another possible cause is the firmware of your keyboard has a bug. See for example https://github.com/qmk/qmk_firmware/issues/19663 . In any case try to upgrade to latest version.
- 151