Archive:HOW-TO:Enable Wake-On-Device for Ubuntu

This Article discusses enabling wake-up from your remote device under Ubuntu. In order to perform the following tasks you must be root.

Note: This article contains examples of what you should see. Examples, marked with eg. will be different then your computer. Please follow the instructions and do not copy and paste examples or undesired results may occour.

Identification of resume devices
This section discusses identification of the resume devices. You must be root for all following steps.

sudo su root
 * Become root

Authorized resume devices
cat /proc/acpi/wakeup You will see a list of authorized resume devices
 * From your terminal type the following to gain a list of all authorized resume devices

EG. root@XBMCLive:~# cat /proc/acpi/wakeup Device S-state   Status   Sysfs node HUB0     S5     disabled  pci:0000:00:04.0 XVR0     S5     disabled  pci:0000:00:09.0 XVR1     S5     disabled  pci:0000:00:0b.0 XVR2     S5     disabled  pci:0000:00:0c.0 PS2M     S4     disabled  pnp:00:08 PS2K     S4     disabled  pnp:00:09 USB0     S3     disabled  pci:0000:00:02.0 USB2     S3     disabled  pci:0000:00:02.1 AZAD     S5     disabled  pci:0000:00:05.0 MMAC     S5     disabled  pci:0000:00:07.0

Note: PS2M = Mouse PS2K = Keyboard USBX = USB where X = bus number USXX = USB where X = double digit bus numbers

more information on devices
lspci
 * You can get more information on wakeup devices by typing the following in a console

You will see a list of PCI devices. The first coloumn in lspci will match the Sysfs node coloumn in /proc/acpi/wakeup

EG. root@XBMCLive:~# lspci 00:00.0 RAM memory: nVidia Corporation MCP61 Memory Controller (rev a1) 00:01.0 ISA bridge: nVidia Corporation MCP61 LPC Bridge (rev a2) 00:01.1 SMBus: nVidia Corporation MCP61 SMBus (rev a2) 00:01.2 RAM memory: nVidia Corporation MCP61 Memory Controller (rev a2) 00:02.0 USB Controller: nVidia Corporation MCP61 USB Controller (rev a3) 00:02.1 USB Controller: nVidia Corporation MCP61 USB Controller (rev a3) 00:04.0 PCI bridge: nVidia Corporation MCP61 PCI bridge (rev a1) 00:05.0 Audio device: nVidia Corporation MCP61 High Definition Audio (rev a2) 00:06.0 IDE interface: nVidia Corporation MCP61 IDE (rev a2) 00:07.0 Bridge: nVidia Corporation MCP61 Ethernet (rev a2) 00:08.0 IDE interface: nVidia Corporation MCP61 SATA Controller (rev a2) 00:08.1 IDE interface: nVidia Corporation MCP61 SATA Controller (rev a2) 00:09.0 PCI bridge: nVidia Corporation MCP61 PCI Express bridge (rev a2) 00:0b.0 PCI bridge: nVidia Corporation MCP61 PCI Express bridge (rev a2) 00:0c.0 PCI bridge: nVidia Corporation MCP61 PCI Express bridge (rev a2) 00:0d.0 VGA compatible controller: nVidia Corporation C61 [GeForce 6150SE nForce 430] (rev a2) 00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration 00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map 00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller 00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

Enabling wakeup status for devices
This section discusses enabling wakeup status for your device.

echo **** > /proc/acpi/wakeup
 * enable wakeup devices to resume the computer by typing the following where **** is replaced with the corresponding device

EG. root@XBMCLive:~# echo USB0 > /proc/acpi/wakeup root@XBMCLive:~# echo USB2 > /proc/acpi/wakeup

Verifying enabled devices
cat /proc/acpi/wakeup EG. root@XBMCLive:~# cat /proc/acpi/wakeup Device S-state   Status   Sysfs node HUB0     S5     disabled  pci:0000:00:04.0 XVR0     S5     disabled  pci:0000:00:09.0 XVR1     S5     disabled  pci:0000:00:0b.0 XVR2     S5     disabled  pci:0000:00:0c.0 PS2M     S4     disabled  pnp:00:08 PS2K     S4     disabled  pnp:00:09 USB0     S3     enabled   pci:0000:00:02.0 USB2     S3     enabled   pci:0000:00:02.1 AZAD     S5     disabled  pci:0000:00:05.0 MMAC     S5     disabled  pci:0000:00:07.0
 * Type the following to verify proper wakeup device status

You should now see that your devices are enabled. Test your resume function at this time and verify proper operation.

Troubleshooting auto-resume
If an enabled device resumes the computer from standby at an undesired time, you may choose to disable it by using the following command where **** is the device you wish to disable echo **** > /proc/acpi/wakeup

EG. enabling USB2 as an enabled wakeup device causes the computer to resume immediately.. root@XBMCLive:~# echo USB2 > /proc/acpi/wakeup

If that doesn't fix the auto-resume issue (meaning your setup still auto-resumes almost immediately after going to sleep), there may be an ACPI conflict that we can fix in GRUB.

There is also a conflict on these ion boards between nvidia SMbus and acpi and we want to fix that so we will do that now as well. This is only a workaround for now, though it may be fixed in later kernels. You can find the bug reports on Google and track them to know when you'll want to remove this line. Here is a link to one https://bugs.launchpad.net/ubuntu/+source/linux/+bug/440780 of the active tickets.

We need to edit our grub boot line in order to accomplish this fix. Since 9.10 and newer uses GRUB2, things are a little different so first lets get out of root by typing

exit

at the command prompt and you should be back at your regular command prompt which will look something like this

xbmc@zotac-ion:~$

We are going to edit out default grub boot line, so paste this into your terminal window

sudo nano /etc/default/grub

The file will now open and the line we want to fix is

GRUB_COMMAND_LINE_DEFAULT="quiet splash"

Cursor down until you find the above line in the file, and now paste the following into that line BETWEEN THE QUOTES, leaving a space after the h in splash.

usbcore.autosuspend=-1 acpi_enforce_resources=lax

Now the line should look like this after editing

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.autosuspend=-1 acpi_enforce_resources=lax"

OK that's done, press CTRL+X and then ENTER to exit editing mode and save the file.

Now we need to update grub let's do that by pasting this

sudo update-grub

You should now be able to reboot, and successfully suspend and resume from the remote without issue.

If your device refuses to resume from standby even while the correct wakeup devices are set in /proc/acpi/wakeup. It could be caused because of a bug in the current Ubuntu kernel. Kernel versions starting from 2.6.32-23 are affected by this bug. A possible solution is to downgrade your kernel to 2.6.32-22.

More information about this: http://forum.xbmc.org/showthread.php?t=76944

Committing to rc.local
sudo gedit /etc/rc.local EG. # # # # echo USB0>/proc/acpi/wakeup echo "rc.local has completed sucessfully." >> /tmp/resume.log exit 0
 * Edit /etc/rc.local and add the echo commands required to enable authorized devices
 * 1) !/bin/sh -e
 * 1) rc.local
 * 1) This script is executed at the end of each multiuser runlevel.
 * 2) Make sure that the script will "exit 0" on success or any other
 * 3) value on error.
 * 1) In order to enable or disable this script just change the execution
 * 2) bits.
 * 1) By default this script does nothing.

Your Wake-On-Device setup is now complete.