ACPId suspend-to-ram: can you specify waking up using keyboard events

acpiacpidgentoo

This is Gentoo Linux with OpenRC (updated to systemd later on), and ACPI + some power management features in the kernel for Intel. ACPId is up and running. I can suspend to ram using:

echo -n "mem" > /sys/power/state

This works, but I need to use the power button to wake up. Is there a way to wake up from keyboard events like pressing the space bar? The keyboard is a wireless USB keyboard. I've looked at the content of the script in /etc/acpi and it offers no insight into doing this. Most of the information I find is usually geared at laptop users. Do I really need something like the old pm-utils to accomplish this and is there anything wrong with just using acpid?

cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
P0P2      S4    *disabled
P0P3      S4    *disabled  pci:0000:00:06.0
P0P1      S4    *disabled  pci:0000:00:1e.0
PS2K      S4    *enabled   pnp:00:0b
EUSB      S4    *enabled   pci:0000:00:1d.7
USBE      S4    *enabled   pci:0000:00:1a.7
P0P4      S4    *disabled  pci:0000:00:1c.0
P0P5      S4    *disabled
P0P6      S4    *disabled  pci:0000:00:1c.2
P0P7      S4    *disabled
P0P8      S4    *disabled
P0P9      S4    *disabled
GBEC      S4    *disabled
USB0      S4    *enabled   pci:0000:00:1d.0
USB1      S4    *enabled   pci:0000:00:1d.1
USB2      S4    *enabled   pci:0000:00:1d.2
USB3      S4    *disabled
USB4      S4    *enabled   pci:0000:00:1a.0
USB5      S4    *enabled   pci:0000:00:1a.1
USB6      S4    *enabled   pci:0000:00:1a.2
MBT4      S4    *disabled

Seemingly relevant kernel options used (3.10.25-gentoo SMP, 64bit, IA32emul=off, no-multilib):

  • CONFIG_HOTPLUG_CPU=y and with cpu0_hotplug by default
  • Suspend to ram and standby Hibernation
  • Power mgmt debug support
  • Suspend/resume event tracing
  • ACPI support
  • CPU idle PM support
  • Cpuidle Driver for Intel Processors
  • Support for systemd through Gentoo option in kernel was enabled

BIOS setup is pretty standard:

  • I've enabled ACPI2.0 extra tables
  • Not seeing any wake events for USB but I've tried wake up events from
    PCI/PCIe/PS2 etc but indeed this is a wireless usb keyboard
  • Board is old school winner Maximus Formula with Q6600 Core2quad

OpenRC was updated to systemd and the kernel was recompiled to support that. Configuration was also updated like so. With systemd, apcid is not required in all instances. For instance without running you can issue systemctl suspend and the behavior is… the same as before i.e. wake up only from power button…

pstree output:

systemd 
  ├─acpid -f
  ├─at-spi-bus-laun
  │   ├─dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork--print-addres
  │   └─2*[{at-spi-bus-laun}]
  ├─at-spi2-registr --use-gnome-session
  │   └─{at-spi2-registr}
  ├─dbus-daemon --system --address=systemd: --nofork --nopidfile--systemd-activation
  ├─dbus-daemon --fork --print-pid 5 --print-address 7 --session
  ├─dbus-launch --sh-syntax --exit-with-session
  ├─dhcpcd -q --nobackground
  ├─login --    
  │   └─bash
  │       └─startx /usr/bin/startx
  │           └─xinit /etc/X11/xinit/xinitrc -- /etc/X11/xinit/xserverrc :0 -auth...
  │               ├─X -nolisten tcp :0 -auth /home/user/.serverauth.3329
  │               └─openbox --startup /usr/libexec/openbox-autostart OPENBOX
  │                   ├─firefox
  │                   │   ├─plugin-containe ...
  │                   │   │   └─6*[{plugin-containe}]
  │                   │   └─35*[{firefox}]
  │                   └─vlc
  │                       └─4*[{vlc}]
  ├─lxterminal
  │   ├─bash
  │   │   └─htop
  │   ├─bash
  │   │   └─su
  │   │       └─bash
  │   │           └─grc /usr/lib/python-exec/python2.7/grc tail -f ...
  │   │               ├─grcat /usr/lib/python-exec/python2.7/grcat conf.log
  │   │               └─tail -f /var/log/emerge.log
  │   ├─bash
  │   ├─gnome-pty-helpe
  │   └─{lxterminal}
  ├─mount.ntfs /dev/sdb1 /mnt/div -o rw
  ├─roxterm
  │   ├─bash
  │   │   └─su
  │   │       └─bash
  │   │           └─pstree -a
  │   ├─gnome-pty-helpe
  │   └─{roxterm}
  ├─systemd --user
  │   └─(sd-pam)                 
  ├─systemd-journal
  ├─systemd-logind
  ├─systemd-udevd
  ├─wbar --pos bot-right --taskbar --isize 24
  └─xcompmgr -c -C -t-5 -l-5 -r4.2 -o.55

Best Answer

This is often also a BIOS setting. You can check it with:

grep ^PWRB /proc/acpi/wakeup  

and enable it with

echo "PWRB" > /proc/acpi/wakeup