148734Siwasaki#!/bin/sh
248734Siwasaki#
366830Sobrien# Copyright (c) 1999  Mitsuru IWASAKI
466830Sobrien# All rights reserved.
566830Sobrien#
666830Sobrien# Redistribution and use in source and binary forms, with or without
766830Sobrien# modification, are permitted provided that the following conditions
866830Sobrien# are met:
966830Sobrien# 1. Redistributions of source code must retain the above copyright
1066830Sobrien#    notice, this list of conditions and the following disclaimer.
1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright
1266830Sobrien#    notice, this list of conditions and the following disclaimer in the
1366830Sobrien#    documentation and/or other materials provided with the distribution.
1466830Sobrien#
1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1866830Sobrien# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2566830Sobrien# SUCH DAMAGE.
2666830Sobrien#
2750472Speter# $FreeBSD$
2848734Siwasaki#
2966830Sobrien
3048734Siwasaki# sample run command file for APM Resume Event
3148734Siwasaki
32124001Snjlif [ $# -ne 2 ]; then
33170976Snjl	echo "Usage: $0 [apm|acpi] [standby,suspend|1-4]"
34124001Snjl	exit 1
35124001Snjlfi
36124001Snjl
37124001Snjlsubsystem=$1
38124001Snjlstate=$2
39124001Snjl
4051231Ssheldonhif [ -r /var/run/rc.suspend.pid ]; then
4148734Siwasaki	kill -9 `cat /var/run/rc.suspend.pid`
42211291Sjkim	/bin/rm -f /var/run/rc.suspend.pid
43124001Snjl	echo 'rc.resume: killed rc.suspend that was still around'
4448734Siwasakifi
4548734Siwasaki
4648734Siwasaki# Turns on a power supply of a card in the slot inactivated.
4748734Siwasaki# See also contrib/pccardq.c (only for PAO users).
4851231Ssheldonh# pccardq | awk -F '~' '$5 == "inactive" \
4951231Ssheldonh#	{ printf("pccardc power %d 1", $1); }' | sh
5048734Siwasaki
51170976Snjl# If a device driver has problems resuming, try unloading it before
52170976Snjl# suspend and reloading it on resume.  Example:
53180681Sthompsa# kldload usb
54124001Snjl
55211291Sjkim/usr/bin/logger -t $subsystem resumed at `/bin/date +'%Y%m%d %H:%M:%S'`
56211291Sjkim/bin/sync && /bin/sync && /bin/sync
5748734Siwasaki
5848734Siwasakiexit 0
59