#!/bin/sh export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin tmpfile=`mktemp` || exit 1 # Pre-suspend hooks (gaim, skype, ...) /usr/local/sbin/presuspend.sh # These always seem to cause problems in whatever sleep mode rmmod ehci_hcd uhci_hcd # Create a state file here and check it in /etc/acpi/powerbtn.sh so acpid # knows that the power button press used to wake the machine shouldn't # hibernate / shutdown / whatever touch /var/run/S3 # Change to text mode to attempt to avoid hangs on resume with new # radeon DRM driver orig_vt=`fgconsole` chvt 1 # Save video state, go to S3, restore video state videomode=`vbetool vbemode get` vbetool vbestate save > $tmpfile echo mem > /sys/power/state vbetool post vbetool vbestate restore < $tmpfile vbetool vbemode set $videomode rm -f $tmpfile # Change back from text mode chvt $orig_vt # Can't load them in parallel with & or nasty things happen modprobe uhci_hcd modprobe ehci_hcd # madwifi sometimes stops scanning. Kick it wpa_cli reassoc # Post-resume hooks /usr/local/sbin/postresume.sh