The power button on my pc case is not very handy to work with, which made waking up by mouse/keyboard an awesome idea. The first thing to achieve this is obviously, getting inside bios and enable the wake up option for keyboard/mouse, LAN or whatever you like. You probably at this step expect that things get to work out of the box.
Well…. probably no. but still you got chance. from my experience some device works out of the box and some simply don’t. why? I think because they are a little too complicated for ACPI to handle them. Here I summarize my workaround to get these kind of devices work.
First of all you need to find device path. Device path is both the way that the device is connected to your computer and also the way you can access your device settings on your computer. To get this path, all you need is to find your keyboard/mouse node on /dev
path and feed it to udevadm. As an example for my keyboard executing something like
udevadm info -q path -n /dev/input/event0
/devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/0003:04F2:0833.0001/input/input2/event0
give this path and for mouse executing
udevadm info -q path -n /dev/input/mouse0
/devices/pci0000:00/0000:00:14.0/usb1/1-13/1-13:1.0/0003:1BCF:0002.0003/input/input4/mouse0
Next you need to surf on your device path and find a file named wakeup. it may be in your device path/power. if not look it parent directory and foreword until you find the right file. For example in my case, wakeup file turned out to be /sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/power/wakeup
. Then you should write enabled inside this file by running
sudo sh -c "echo enabled > '/sys/devices/pci0000:00/0000:00:14.0/usb1/1-13/power/wakeup'"
If you are standing on a right place then probably double clicking cause your pc to wake up after suspension. if not try to looking the parent folder.
As you know udev let you run script if specific device connected to the kernel, we exploit the idea and enable wakeup for our little cute mice.
/etc/udev/rules.d/90-keyboardwakeup.rules
-----------------------
SUBSYSTEM=="usb", ATTRS{idVendor}=="1b1c", ATTRS{idProduct}=="1b19" RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup;'"
Hope You Enjoy
Hello,
I enjoyed reading your article but, could you please explain what you do on step 3. Thanks