петък, 8 април 2011 г.

How to wake up your Ubuntu/Kubuntu/Xbuntu Maverick from USB port

This is a "how-to" , describing how to enable USB wake up from suspend/sleep on a Ubuntu 10.10 system. It worked for me on Lucid 10.04 with Maverick and Natty kernels applied.
I got and old Thinkpad x40 laptop, which I use for a multimedia machine with Xubuntu 10.04 and XBMC installed. I tried this method on Kubuntu 10.10, so I suppose it should be working on Ubuntu, too.
So , first lets find out the id of the device which will be used for waking up the system - in my case, a Logitech USB mouse(Everything published in Courier are terminal commands)

lsusb 

This is the terminal output:


Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 046d:c521 Logitech, Inc. Cordless Mouse Receiver
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub




So, the ID of the device is:
c521

Second command(change the device ID with yours):
grep c521 /sys/bus/usb/devices/*/idProduct

Here is the output:



/sys/bus/usb/devices/3-1/idProduct:c521

You should get the number after the devices/, in my case 3-1. This should be used later.

Now, run this

cat /proc/acpi/wakeup

This will populate all methods from waking your PC from sleep and hibernate, and if it is enabled or not. My list is

Device S-state Status Sysfs node
LID S3 *enabled
SLPB S3 *enabled
PCI0 S3 *disabled no-bus:pci0000:00
PCI1 S4 *disabled pci:0000:00:1e.0
DOCK S4 *disabled
USB0 S3 *disabled pci:0000:00:1d.0
USB1 S3 *disabled pci:0000:00:1d.1
USB2 S3 *disabled pci:0000:00:1d.2
AC9M S4 *disabled pci:0000:00:1f.6


I know I have to use USB0 in my case. I dont know a way to tell which USB port uses my mouse in the moment, besides the trial and error method. It is disabled at  the moment. Or, you can enable all.

sudo -s  (enter password when prompted)
echo "USB0" > /proc/acpi/wakeup
echo enabled > /sys/bus/usb/devices/3-1/power/wakeup

Then run

cat /proc/acpi/wakeup


to verify the port is enabled. You can try this now.

If something goes wrong, try creating /etc/rc.d/local.
look here:
http://forums.whirlpool.net.au/archive/1376177

Lets make this run on startup


sudo gedit /etc/rc.local

and paste at the end of the file:


echo "USB0" > /proc/acpi/wakeup

echo enabled > /sys/bus/usb/devices/3-1/power/wakeup

That should do it :) 






Няма коментари:

Публикуване на коментар