# Waking up from sleep

## danomac

I've been fighting with waking up from sleep with my keyboard and mouse on my PC since I got sleep working.

Sleep works fine if I use the power button to wake up the computer. This isn't always convenient. I dual-boot my PC with Windows, and it is working, so I don't think there's any BIOS settings or jumpers or the like that need to be changed.

I did discover /proc/acpi/wakeup, but even enabling everything it still doesn't wake.

```

~ # cat /proc/acpi/wakeup

Device  S-state   Status   Sysfs node

P0P2      S4    *enabled   pci:0000:00:01.0

P0P3      S4    *enabled   

P0P1      S4    *enabled   pci:0000:00:1e.0

EUSB      S4    *enabled   pci:0000:00:1d.7

USBE      S4    *enabled   pci:0000:00:1a.7

P0P5      S4    *enabled   

P0P6      S4    *enabled   

P0P7      S4    *enabled   

P0P8      S4    *enabled   

P0P9      S4    *enabled   pci:0000:00:1c.5

GBEC      S4    *enabled   

USB0      S4    *enabled   pci:0000:00:1d.0

USB1      S4    *enabled   pci:0000:00:1d.1

USB2      S4    *enabled   pci:0000:00:1d.2 <-- this is where my keyboard/mouse should be

USB3      S4    *disabled  

USB4      S4    *enabled   pci:0000:00:1a.0

USB5      S4    *enabled   pci:0000:00:1a.1

USB6      S4    *disabled  pci:0000:00:1a.2

P0P4      S4    *enabled   pci:0000:00:1c.0

```

The two that are still disabled will not enable for some reason. Edit: come to think of it, I think I did not use one of the USB headers on the motherboard...

```

~ # lsusb

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Bus 001 Device 002: ID 058f:6362 Alcor Micro Corp. Flash Card Reader/Writer

Bus 001 Device 003: ID 0b05:1742 ASUSTek Computer, Inc. 802.11n Network Adapter

Bus 006 Device 002: ID 03f0:0901 Hewlett-Packard ScanJet 2300c

Bus 006 Device 003: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

Bus 008 Device 002: ID 046d:c508 Logitech, Inc. Cordless Trackball

Bus 008 Device 003: ID 046d:c223 Logitech, Inc. G11/G15 Keyboard / USB Hub

Bus 008 Device 004: ID 046d:c221 Logitech, Inc. G11/G15 Keyboard / Keyboard

Bus 008 Device 005: ID 046d:c222 Logitech, Inc. G15 Keyboard / LCD

```

I've traced my keyboard to BUS 8 / pci id 1d.2:

```

~ # lspci 

00:00.0 Host bridge: Intel Corporation 4 Series Chipset DRAM Controller (rev 02)

00:01.0 PCI bridge: Intel Corporation 4 Series Chipset PCI Express Root Port (rev 02)

00:1a.0 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4

00:1a.1 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5

00:1a.2 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6

00:1a.7 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2

00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller

00:1c.0 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 1

00:1c.5 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 6

00:1d.0 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1

00:1d.1 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2

00:1d.2 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3 <-- this is where my keyboard/mouse should be

00:1d.7 USB Controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1

00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90)

00:1f.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller

00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller

00:1f.3 SMBus: Intel Corporation 82801JI (ICH10 Family) SMBus Controller

01:00.0 VGA compatible controller: nVidia Corporation G92 [GeForce 8800 GTS 512] (rev a2)

02:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8056 PCI-E Gigabit Ethernet Controller (rev 12)

04:03.0 FireWire (IEEE 1394): Agere Systems FW322/323 (rev 70)

```

Here's the kernel options for PM:

```

#

# Power management and ACPI options

#

CONFIG_PM=y

CONFIG_PM_DEBUG=y

# CONFIG_PM_ADVANCED_DEBUG is not set

# CONFIG_PM_VERBOSE is not set

CONFIG_CAN_PM_TRACE=y

CONFIG_PM_TRACE=y

CONFIG_PM_TRACE_RTC=y

CONFIG_PM_SLEEP_SMP=y

CONFIG_PM_SLEEP=y

CONFIG_SUSPEND_NVS=y

CONFIG_SUSPEND=y

# CONFIG_PM_TEST_SUSPEND is not set

CONFIG_SUSPEND_FREEZER=y

# CONFIG_HIBERNATION is not set

# CONFIG_PM_RUNTIME is not set

CONFIG_PM_OPS=y

CONFIG_ACPI=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_PROCFS=y

CONFIG_ACPI_PROCFS_POWER=y

# CONFIG_ACPI_POWER_METER is not set

# CONFIG_ACPI_EC_DEBUGFS is not set

CONFIG_ACPI_PROC_EVENT=y

# CONFIG_ACPI_AC is not set

# CONFIG_ACPI_BATTERY is not set

CONFIG_ACPI_BUTTON=y

CONFIG_ACPI_FAN=y

# CONFIG_ACPI_DOCK is not set

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_HOTPLUG_CPU=y

# CONFIG_ACPI_PROCESSOR_AGGREGATOR is not set

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_CUSTOM_DSDT is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

# CONFIG_ACPI_PCI_SLOT is not set

CONFIG_X86_PM_TIMER=y

CONFIG_ACPI_CONTAINER=y

# CONFIG_ACPI_SBS is not set

# CONFIG_ACPI_HED is not set

# CONFIG_ACPI_APEI is not set

# CONFIG_SFI is not set

#

# CPU Frequency scaling

#

CONFIG_CPU_FREQ=y

CONFIG_CPU_FREQ_TABLE=y

CONFIG_CPU_FREQ_DEBUG=y

# CONFIG_CPU_FREQ_STAT is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set

# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set

CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set

# CONFIG_CPU_FREQ_GOV_USERSPACE is not set

CONFIG_CPU_FREQ_GOV_ONDEMAND=y

# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set

#

# CPUFreq processor drivers

#

# CONFIG_X86_PCC_CPUFREQ is not set

CONFIG_X86_ACPI_CPUFREQ=y

# CONFIG_X86_POWERNOW_K8 is not set

# CONFIG_X86_SPEEDSTEP_CENTRINO is not set

# CONFIG_X86_P4_CLOCKMOD is not set

#

# shared options

#

# CONFIG_X86_SPEEDSTEP_LIB is not set

CONFIG_CPU_IDLE=y

CONFIG_CPU_IDLE_GOV_LADDER=y

CONFIG_CPU_IDLE_GOV_MENU=y

CONFIG_INTEL_IDLE=y

#

# Memory power savings

#

CONFIG_I7300_IDLE_IOAT_CHANNEL=y

CONFIG_I7300_IDLE=y

```

Using kernel 2.6.37-gentoo-r4.

I don't really know where else to look, and this is still bugging me. Is /proc/acpi/wakeup deprecated? Am I supposed to use some other interface to do what I'm trying to do? All I had to do in Windows was check something like "allow this device to wake the PC from sleep" and it worked.

I am using KDE 4.6 to sleep, FWIW. It enters sleep mode fine, and as I said, I can wake it with the power button, but that's about it.

----------

## Thistled

Could it be because you are using USB keyboard and mouse?

Which is why you have to use the power button to wake it up.

If you were using a PS/2 connected mouse then I suspect you would be able to awaken your system, but with usb that is a no-no.

At least in my experience.

The attached USB devices are basically dead when there is no power in the system, which is why they don't work.

Surreal.

----------

## danomac

 *Thistled wrote:*   

> Could it be because you are using USB keyboard and mouse?
> 
> Which is why you have to use the power button to wake it up.
> 
> If you were using a PS/2 connected mouse then I suspect you would be able to awaken your system, but with usb that is a no-no.
> ...

 

I do have a USB trackball and keyboard.

The same USB trackball and keyboard wake the system from sleep in Windows (I dual-boot this machine), although I had to check something in device properties in Windows as I mentioned in the first post.

I noticed that the kernel has an option for "deprecated /proc/acpi" entries, which is what I'm trying to use. All of the acpi stuff on the intarweb say to use this. If it's deprecated, where did it all move to? Maybe I'm using the wrong interface for it.

----------

## Thistled

Have you had a look at BIOS settings? (Sorry, I don't mean to insult your intelligence man)

Also, this sounds crazy, but see if you can attach your USB keyboard or trackball to PS/2 (for which you will need an adapter), and make sure PS/2 support is built in to the kernel.

Then see if that awakens your box.

In my experience, anything which is connected via USB is completely dead when the system is asleep, but a hit on the keyboard or any mouse movement (whilst connected via PS/2) wakes the box up.

----------

## danomac

 *Thistled wrote:*   

> Have you had a look at BIOS settings? (Sorry, I don't mean to insult your intelligence man)
> 
> Also, this sounds crazy, but see if you can attach your USB keyboard or trackball to PS/2 (for which you will need an adapter), and make sure PS/2 support is built in to the kernel.
> 
> Then see if that awakens your box.
> ...

 

As I said above, the BIOS and jumpers are set. It will wake up from sleep in Vista if I press any key on the keyboard or move the mouse (dual-boot.)

I suspect that it's a kernel problem. I was going to try to boot Ubuntu from a live-cd and try it, but I actually forgot about it. As much as I hate pressing the damn power button to wake the PC, I guess I'm just getting used to it.   :Laughing:   :Confused:   :Sad: 

----------

## danomac

I had to replace my motherboard - now I have an Intel one, and it works like expected. I guess Asus boards (my previous two boards)  just don't work right.

----------

## depontius

I have a mythfrontend "appliance" in the living room, and use suspend in order to make it start faster, and be more appliance-like.  The primary interface to this machine is a conventional RC6 remote control, though there is a wireless keyboard tucked away under the cabinet for use when necessary.

Through the 2.6.32 series this all worked just fine.  I had lirc and hibernate-script set up so that pushing the power button on the remote when the system was on would suspend, and pushing the power button when the system was suspended would wake it.  The only thing necessary to enable wakeup was to enable the right device in /proc/acpi/wakeup.  After 2.6.32 I was unable to get this to work.  Eventually I found out that I needed to go into the /sys tree in the USB stuff, and enable the specific device to wake there, too.  Apparently this change must have gone in with 2.6.33.  I'm don't have access to that system now, so I can't tell you exactly what I did, but something was needed to enable the specific USB device to wake the system, as well as telling the system to listen to that device.  That system is now running 2.6.38-*, but the limitations holding me there are different story for a different thread.

----------

## danomac

 *depontius wrote:*   

> I have a mythfrontend "appliance" in the living room, and use suspend in order to make it start faster, and be more appliance-like.  

 

I didn't bother with suspend on my mythtv frontend. I got a SSD for it and got boot times down to <11 seconds, perhaps 25-30 from power on (post can take up to 20 seconds.)

My old cable set top box could take up to 45 seconds to be usable, so 30 seconds is quite acceptable to me.

----------

