Monday 1 February 2021

How to control which device event can wake up your computer from standby?

Level 1 method:

Look at /proc/acpi/wakeup:

Device  S-state   Status   Sysfs node
PEG0      S4    *disabled  pci:0000:00:01.0
PEGP      S4    *disabled  pci:0000:01:00.0
PEG1      S4    *disabled
PEGP      S4    *disabled
PEG2      S4    *disabled
PEGP      S4    *disabled
RP01      S4    *disabled  pci:0000:00:1c.0
PXSX      S4    *disabled  pci:0000:3b:00.0
RP02      S4    *disabled
PXSX      S4    *disabled
RP03      S4    *disabled
PXSX      S4    *disabled
RP04      S4    *disabled
PXSX      S4    *disabled
RP05      S4    *disabled  pci:0000:00:1c.4
PXSX      S4    *disabled  pci:0000:3c:00.0
                *disabled  platform:rtsx_pci_sdmmc.0
                *disabled  platform:rtsx_pci_ms.0
RP06      S4    *disabled
PXSX      S4    *disabled
RP07      S4    *disabled
This device file shows devices that are allowed to wake up the system from standby. You can toggle each item by (e.g.):

echo PEG0 >> /proc/acpi/wakeup
For the device code name:

  • PS2K: PS/2 keyboard
  • PS2M: PS/2 mouse
  • PWRB or PBTN: Power button
  • LID: Laptop lid
  • RP0x or EXPx: PCIE slot #x (aka PCI Express Root Port #x)
  • EHCx or USBx: USB 2.0 (EHCI) chip
  • XHC: USB 3.0 (XHCI) chip
  • PEGx: PCI Express for Graphics slot #x
  • GLAN: Gigabit Ethernet

More can be found in ACPI specification.


Level 2 method (if Level 1 method does not work):

If the device does not appear in /proc/acpi/wakeup, you can search for device files named wakeup in /sys/devices folder recursively. You can enable/disable wakeup by (e.g.):

echo enabled > /sys/devices/platform/i8042/serio0/power/wakeup
Since ACPI devices are organized in a tree structure, on certain computers, it might happen that even if you enabled the leaf node, the parent node is still disabled, so it still does not wakeup. On one laptop, after such configuration, pressing the power button does not wake up the system; while holding down the power button for 10 seconds wakes up the system from standby.