Debian – Turn system on by USB keyboard

debianlinuxpower-managementusbx86

To hibernate my Debian Wheezy system, I run the following command:

sudo sh -c 'echo disk > /sys/power/state'

To wake up the system, I can press any key on my USB keyboard. My understanding of hibernation/suspend to disk is that the machine state is saved into swap space, and the machine is completely powered off.

Is it possible to enable "Wake on USB" without hibernating the system? So I can power on the system, by pressing a key on the keyboard, after a normal shutdown?

So far I have located the USB port the keyboard is connected to, and tried the following command:

sudo sh -c 'echo enabled > /sys/bus/usb/devices/2-4/power/wakeup'

But after shutting the system down, I cannot turn it on again by pressing a key on the keyboard. The fact that the power is completely cut off when hibernating the system, makes me believe that it could also be possible to wake the system by USB from normal shutdown. But I have not found any solution yet.

Best Answer

This depends on what level of ACPI wakeup is supported in your BIOS and motherboard. For more detail, please see ACPI global states; but in short, it will come down to your BIOS supporting wake from various states:

  • S3: Suspend to RAM
  • S4: Hiberate
  • G2/S5: Soft off

Additionally, on some motherboards, only a subset of USB ports might support wake-on-USB. I suggest checking the documentation for your manualboard.

Goldilocks did suggest in comments that a kernel hack might help, and he was close, but you don't actually need to modify the kernel. Instead, you would modify your poweroff scripts, such that at the last phase of poweroff, you write 4 or disk to /sys/power/state. I'm not sure that approach will actually help, unless your system only implements USB-wake-from-S4 and not USB-wake-from-S5, which is unlikely (they are practically identical in system design).

Related Question