aboutsummaryrefslogtreecommitdiff
path: root/etc/rc.suspend
diff options
context:
space:
mode:
authorNate Lawson <njl@FreeBSD.org>2003-12-30 17:28:06 +0000
committerNate Lawson <njl@FreeBSD.org>2003-12-30 17:28:06 +0000
commite776370e2b92b1e6f31f0447169e758fcc8e4e4c (patch)
tree7df2978487882efbbd26988ce7aa085b9147d6fc /etc/rc.suspend
parent47fea40f85ae629f0caf882ae61d1fe0a6e7cd79 (diff)
downloadsrc-e776370e2b92b1e6f31f0447169e758fcc8e4e4c.tar.gz
src-e776370e2b92b1e6f31f0447169e758fcc8e4e4c.zip
Add support for /etc/rc.suspend and /etc/rc.resume for ACPI. They are
called directly from acpiconf(8). Change both scripts to take a subsystem (apm|acpi) and sleep level (suspend,standby|1-5) argument.
Notes
Notes: svn path=/head/; revision=124001
Diffstat (limited to 'etc/rc.suspend')
-rwxr-xr-xetc/rc.suspend18
1 files changed, 15 insertions, 3 deletions
diff --git a/etc/rc.suspend b/etc/rc.suspend
index 8b3e4fa4d01e..8b02a0fadebd 100755
--- a/etc/rc.suspend
+++ b/etc/rc.suspend
@@ -29,6 +29,14 @@
# sample run command file for APM Suspend Event
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 [apm|acpi] [standby,suspend|1-5]"
+ exit 1
+fi
+
+subsystem=$1
+state=$2
+
if [ -r /var/run/rc.suspend.pid ]; then
exit 1
fi
@@ -40,11 +48,15 @@ echo $$ > /var/run/rc.suspend.pid
# pccardq | awk -F '~' '$5 == "filled" && $4 ~ /sio/ \
# { printf("pccardc power %d 0", $1); }' | sh
-logger -t apmd suspend at `date +'%Y%m%d %H:%M:%S'`
+# UHCI has trouble resuming so we just load/unload it. You
+# should add any other kernel modules you want unloaded here.
+# kldunload usb
+
+logger -t $subsystem suspend at `date +'%Y%m%d %H:%M:%S'`
sync && sync && sync
-sleep 3
+[ $subsystem = "apm" ] && sleep 3
rm -f /var/run/rc.suspend.pid
-zzz
+[ $subsystem = "apm" ] && zzz
exit 0