00a304487f
Improvements: * /etc/rc.suspend,rc.resume are always run, no matter the source of the suspend request (user or kernel, apm or acpi) * suspend now requires positive user acknowledgement. If a user program wants to cancel the suspend, they can. If one of the user programs hangs or doesn't respond within 10 seconds, the system suspends anyway. * /dev/apm is clonable, allowing multiple listeners for suspend events. In the future, xorg-server can use this to be informed about suspend even if there are other listeners (i.e. apmd). Changes: * Two new ACPI ioctls: REQSLPSTATE and ACKSLPSTATE. Request begins the process of suspending by notifying all listeners. acpi is monitored by devd(8) and /dev/apm listener(s) are also counted. Users register their approval or disapproval via Ack. If anyone disapproves, suspend is vetoed. * Old user programs or kernel modules that used SETSLPSTATE continue to work. A message is printed once that this interface is deprecated. * acpiconf gains the -k flag to ack the suspend request. This flag is undocumented on purpose since it's only used by /etc/rc.suspend. It is not intended to be a permanent change and will be removed once a better power API is implemented. * S5 (power off) is no longer supported via acpiconf -s 5 or apm -z/-Z. This restores previous behavior of halt/shutdown -p being the interface. * Miscellaneous improvements to error reporting Approved by: re
63 lines
2.2 KiB
Bash
Executable File
63 lines
2.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) 1999 Mitsuru IWASAKI
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# sample run command file for APM Resume Event
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
|
|
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.resume: killed rc.suspend that was still around'
|
|
fi
|
|
|
|
# Turns on a power supply of a card in the slot inactivated.
|
|
# See also contrib/pccardq.c (only for PAO users).
|
|
# pccardq | awk -F '~' '$5 == "inactive" \
|
|
# { printf("pccardc power %d 1", $1); }' | sh
|
|
|
|
# If a device driver has problems resuming, try unloading it before
|
|
# suspend and reloading it on resume. Example:
|
|
# kldunload usb
|
|
|
|
# wpa_supplicant(8) doesn't seem to reassociate during resume. Uncomment
|
|
# the following to signal it to reassociate.
|
|
# /usr/sbin/wpa_cli reassociate
|
|
|
|
logger -t $subsystem resumed at `date +'%Y%m%d %H:%M:%S'`
|
|
sync && sync && sync
|
|
|
|
exit 0
|