I have an Asus EeePC on which I’ve installed Ubuntu 9.10. But now I wanted a working hibernate (suspend to disk) and suspend (suspend to memory).

Hibernate was working out of the box (well the going to sleep part, at least), but resuming took almost as long as a cold boot. Another thing was that my wireless was broken after a resume. On my happiness scale (range: 0-10) this scored a 3.

To fix the wireless I thought I could just unload the ath9k module before suspending and loading it on resume. For this I added a modules script in the following directory /etc/pm/sleep.d:

#!/bin/sh
# Action script to remove/add modules

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# pm-action(8) - <action> <suspend method>
#
case "${1}" in
    suspend|hibernate)
	    modprobe -r ath9k
	    ;;
    resume|thaw)
	    modprobe ath9k
	    ;;
esac

After this my wireless was working like a charm. On my happiness scale (range: 0-10) this scored a 5.

So next up: fix suspend. What was the problem? I could suspend my laptop, but it came right back to live after a few seconds of suspending. Not very useful.

After some googling around it hit me, USB wake ups! But how to do silence the wake ups from your USB devices? The following works for me:

# disable wakeup events when suspending from USB
echo disabled > /sys/bus/usb/devices/usb1/power/wakeup
echo disabled > /sys/bus/usb/devices/usb2/power/wakeup
echo disabled > /sys/bus/usb/devices/usb3/power/wakeup
echo disabled > /sys/bus/usb/devices/usb4/power/wakeup

Now both hibernate and suspend are working (happniess = 8).