[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

USB wake from suspend udev incantation



I've got a desktop system with no ps/2 ports. I wanted to wake the machine from S3 suspend using either the USB keyboard or mouse. After researching this topic a bit online, I was unable to find a reasonably simple solution. Following some study, I devised the following udev rule for enabling the wakeup capability of any attached USB HID device. Or at least any directly attached USB HID device. It turns out that the "enabled" string has to be present in the power/wakeup file associated with the actual device(s) and in the analogous file associated with the host controller. Adding intervening hubs would presumably complicate matters. The rule is pasted below and in the attached file.

Enjoy.

------------------------------------ /etc/udev/rules.d/90-persistent-usb.rules------------------------------------------------------------------

ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usbhid", RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../../power/wakeup'", RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup'"
ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usbhid", RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../../power/wakeup'", RUN+="/bin/sh -c 'echo enabled > /sys$env{DEVPATH}/../power/wakeup'"

Reply to: