diff options
author | njl <njl@FreeBSD.org> | 2003-12-30 17:28:06 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2003-12-30 17:28:06 +0000 |
commit | dc92f60c73455d47a4f12fcc4033cda71d5e3010 (patch) | |
tree | 7df2978487882efbbd26988ce7aa085b9147d6fc /etc | |
parent | af0a8468003fa6f8023d5ca404fc9a2b2a276057 (diff) | |
download | FreeBSD-src-dc92f60c73455d47a4f12fcc4033cda71d5e3010.zip FreeBSD-src-dc92f60c73455d47a4f12fcc4033cda71d5e3010.tar.gz |
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.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/apmd.conf | 4 | ||||
-rwxr-xr-x | etc/rc.resume | 16 | ||||
-rwxr-xr-x | etc/rc.suspend | 18 |
3 files changed, 31 insertions, 7 deletions
diff --git a/etc/apmd.conf b/etc/apmd.conf index 4dc79be..6726730 100644 --- a/etc/apmd.conf +++ b/etc/apmd.conf @@ -4,7 +4,7 @@ # apm_event SUSPENDREQ { - exec "/etc/rc.suspend"; + exec "/etc/rc.suspend apm suspend"; } apm_event USERSUSPENDREQ { @@ -14,7 +14,7 @@ apm_event USERSUSPENDREQ { } apm_event NORMRESUME, STANDBYRESUME { - exec "/etc/rc.resume"; + exec "/etc/rc.resume apm resume"; } # resume event configuration for serial mouse users by diff --git a/etc/rc.resume b/etc/rc.resume index ee1b82c..84aa022 100755 --- a/etc/rc.resume +++ b/etc/rc.resume @@ -29,10 +29,18 @@ # sample run command file for APM Resume Event +if [ $# -ne 2 ]; then + echo "Usage: $0 [apm|acpi] [resume|1-5]" + exit 1 +fi + +subsystem=$1 +state=$2 + if [ -r /var/run/rc.suspend.pid ]; then kill -9 `cat /var/run/rc.suspend.pid` rm -f /var/run/rc.suspend.pid - echo 'rc.suspend is killed' + echo 'rc.resume: killed rc.suspend that was still around' fi # Turns on a power supply of a card in the slot inactivated. @@ -40,7 +48,11 @@ fi # pccardq | awk -F '~' '$5 == "inactive" \ # { printf("pccardc power %d 1", $1); }' | sh -logger -t apmd resumed 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 reloaded here. +# kldload usb + +logger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'` sync && sync && sync exit 0 diff --git a/etc/rc.suspend b/etc/rc.suspend index 8b3e4fa..8b02a0f 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 |