Disable USB keyboard wakeup

With the update from 11.04 to 12.04, my USB keyboard activity will wake Ubuntu from 'suspend'. I'd like to disable this. (My battery went dead due to some unexpected keyboard activity.) This didn't happen in 11.04.

These links talk about USB power ctrl:

http://azitech.wordpress.com/2008/11/27/usbcore-autosuspend/
http://ubuntuforums.org/showthread.php?t=1968487
https://askubuntu.com/questions/165050/usb-wake-not-working-correctly
http://www.ehow.com/how_7536984_configure-power-usb-ubuntu.html
http://www.linuxforums.org/forum/miscellaneous/98253-turn-off-power-usb-port.html
http://www.linuxquestions.org/questions/linux-software-2/howdoi-turn-on-off-usb-light-by-time-514863/
http://www.linuxquestions.org/questions/debian-26/power-off-usb-509328/
http://ubuntuforums.org/showthread.php?t=853179
http://ubuntuforums.org/showthread.php?t=1446965

The USB PwrMan doc: http://www.mjmwired.net/kernel/Documentation/usb/power-management.txt

Unfortunately, none offer a solution for me.

All my /sys/bus/usb/devices/usbx/wakeup are set to disable. When you get the actual device, those are set to enabled, and are not editable.

$ cat /proc/acpi/wakeup
EHC1  S3  *enabled  
EHC2  S3  *enabled

Is there another way to disable USB wakeup?


Solution 1:

You can toggle the enabled/disabled state of each device in /proc/acpi/wakeup by writing the device name into that file. For my system (Debian, not Ubuntu) I have the following in my /etc/rc.local to do this:

# Disable USB wakeups caused by (un)plugging new devices. Otherwise the hub in
# my USB monitor causes my PC to wake up when I turn the monitor off.
for device in EHC1 EHC2 XHC
do
    if grep -q "$device.*enabled" /proc/acpi/wakeup
    then
        echo $device > /proc/acpi/wakeup
    fi
done