Wake Ubuntu with USB mouse or keyboard

I tend to suspend my Ubuntu machine quite a bit. A three second wakeup is a lot faster than a 30 second boot and I can keep my windows open while the machine is asleep without using much more power than a fully shut down computer.

Instead of having to reach for a power button on my computer's case, I have set up Ubuntu to come out of suspend mode when I press any key on my keyboard. Here's how you do it.

First, you want to find check out your the devices that can wake your machine via acpi:

cat /proc/acpi/wakeup

which came back with this, for me:

So I issued the command

sudo sh -c 'echo "USBE" > /proc/acpi/wakeup'

I have seen some people use USB0 instead of USB0, but since it was not listed under wakeup devices by acpi, I used USBE. You can judge for yourself as to which you should use.

There you have it. Your machine should wake up when you press a key, given your keyboard is USB.