From be16db802f075e6d3399b571b73a5d2d901565f4 Mon Sep 17 00:00:00 2001 From: iwasaki Date: Sat, 10 Jul 1999 18:02:42 +0000 Subject: [PATCH] Put apmd configuration and rc files in /etc. Update some files for apmd. --- etc/MAKEDEV | 8 ++++++-- etc/Makefile | 5 +++-- etc/apmd.conf | 38 ++++++++++++++++++++++++++++++++++++++ etc/etc.amd64/rc.amd64 | 6 +++++- etc/etc.i386/MAKEDEV | 8 ++++++-- etc/etc.i386/rc.i386 | 6 +++++- etc/rc.resume | 23 +++++++++++++++++++++++ etc/rc.suspend | 27 +++++++++++++++++++++++++++ 8 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 etc/apmd.conf create mode 100755 etc/rc.resume create mode 100755 etc/rc.suspend diff --git a/etc/MAKEDEV b/etc/MAKEDEV index 8875bb4d212d..328fcec97c24 100644 --- a/etc/MAKEDEV +++ b/etc/MAKEDEV @@ -109,6 +109,7 @@ # # Special purpose devices: # apm Advanced Power Management BIOS +# apmctl APM BIOS control device # bpf* packet filter # speaker pc speaker # tw* xten power controller @@ -130,7 +131,7 @@ # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth) # kbd keyboard devices # -# $Id: MAKEDEV,v 1.204 1999/07/09 13:37:58 sheldonh Exp $ +# $Id: MAKEDEV,v 1.205 1999/07/09 21:35:17 phk Exp $ # PATH=/sbin:/bin/:/usr/bin:/usr/sbin:$PATH @@ -236,7 +237,7 @@ all) sh MAKEDEV ums0 ulpt0 ugen0 # cdev, USB devices sh MAKEDEV bpf0 ipl tun0 # cdev, network sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous - sh MAKEDEV apm card0 card1 card2 card3 # cdev, laptop + sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop sh MAKEDEV pass4 xpt2 # cdev, CAM sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN @@ -1219,8 +1220,11 @@ gsc*) apm*) chr=39 mknod apm c $chr 0 + mknod apmctl c $chr 8 chgrp operator apm + chgrp operator apmctl chmod 660 apm + chmod 660 apmctl ;; card*) diff --git a/etc/Makefile b/etc/Makefile index 0dd6a3bcf8da..9ead10762d59 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,5 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $Id: Makefile,v 1.199 1999/06/24 09:45:17 sheldonh Exp $ +# $Id: Makefile,v 1.200 1999/07/09 05:30:33 obrien Exp $ SUBDIR= sendmail @@ -7,6 +7,7 @@ BIN1= aliases amd.map auth.conf crontab csh.cshrc csh.login csh.logout \ dhclient.conf dm.conf fbtab ftpusers gettytab group hosts hosts.allow \ host.conf hosts.equiv hosts.lpd inetd.conf login.access login.conf \ motd modems networks newsyslog.conf pam.conf pccard.conf.sample \ + apmd.conf \ phones printcap profile protocols rc rc.atm rc.devfs rc.diskless1 \ rc.diskless2 rc.firewall rc.isdn rc.network rc.pccard rc.serial \ rc.shutdown etc.${MACHINE_ARCH}/rc.${MACHINE_ARCH} remote security \ @@ -17,7 +18,7 @@ BIN1= aliases amd.map auth.conf crontab csh.cshrc csh.login csh.logout \ ${.CURDIR}/../usr.bin/locate/locate/locate.rc # -rwxr-xr-x root.wheel, for the new cron root.wheel -BIN2= netstart pccard_ether +BIN2= netstart pccard_ether rc.suspend rc.resume MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \ BSD.var.dist BSD.x11.dist diff --git a/etc/apmd.conf b/etc/apmd.conf new file mode 100644 index 000000000000..d53be02e1c5f --- /dev/null +++ b/etc/apmd.conf @@ -0,0 +1,38 @@ +# apmd Configration File +# +# $Id: apmd.conf,v 1.1.1 1999/07/09 01:34:57 iwasaki Exp $ +# + +apm_event SUSPENDREQ { + exec "/etc/rc.suspend"; +} + +apm_event USERSUSPENDREQ { + exec "sync && sync && sync"; + exec "sleep 1"; + exec "apm -z"; +} + +apm_event NORMRESUME, STANDBYRESUME { + exec "/etc/rc.resume"; +} + +# resume event configuration for serial mouse users by +# reinitializing a moused(8) connected to a serial port. +# +#apm_event NORMRESUME { +# exec "kill -HUP `cat /var/run/moused.pid`"; +#} + +# suspend request event configuration for ATA HDD users: +# execute standby instead of suspend. +# +#apm_event SUSPENDREQ { +# reject; +# exec "sync && sync && sync"; +# exec "sleep 1"; +# exec "apm -Z"; +#} + +# apmd Configration ends here + diff --git a/etc/etc.amd64/rc.amd64 b/etc/etc.amd64/rc.amd64 index 219eb09f6d7a..a131d16da0c8 100644 --- a/etc/etc.amd64/rc.amd64 +++ b/etc/etc.amd64/rc.amd64 @@ -1,6 +1,6 @@ #!/bin/sh - # -# $Id: rc.i386,v 1.38 1999/01/29 18:09:38 yokota Exp $ +# $Id: rc.i386,v 1.39 1999/01/30 07:22:29 newton Exp $ # Do i386 specific processing # @@ -10,6 +10,10 @@ if [ "X$apm_enable" = X"YES" ] ; then apmconf -e > /dev/null 2>&1 fi +if [ "X$apmd_enable" = X"YES" ] ; then + echo -n ' apmd'; apmd +fi + # Start the SCO binary emulation if requested. if [ "X${ibcs2_enable}" = X"YES" ]; then echo -n ' ibcs2'; ibcs2 > /dev/null 2>&1 diff --git a/etc/etc.i386/MAKEDEV b/etc/etc.i386/MAKEDEV index 8875bb4d212d..328fcec97c24 100644 --- a/etc/etc.i386/MAKEDEV +++ b/etc/etc.i386/MAKEDEV @@ -109,6 +109,7 @@ # # Special purpose devices: # apm Advanced Power Management BIOS +# apmctl APM BIOS control device # bpf* packet filter # speaker pc speaker # tw* xten power controller @@ -130,7 +131,7 @@ # ipl ipfilter control devices (ipl, ipnat, ipstate, ipauth) # kbd keyboard devices # -# $Id: MAKEDEV,v 1.204 1999/07/09 13:37:58 sheldonh Exp $ +# $Id: MAKEDEV,v 1.205 1999/07/09 21:35:17 phk Exp $ # PATH=/sbin:/bin/:/usr/bin:/usr/sbin:$PATH @@ -236,7 +237,7 @@ all) sh MAKEDEV ums0 ulpt0 ugen0 # cdev, USB devices sh MAKEDEV bpf0 ipl tun0 # cdev, network sh MAKEDEV ch0 perfmon tw0 # cdev, miscellaneous - sh MAKEDEV apm card0 card1 card2 card3 # cdev, laptop + sh MAKEDEV apm apmctl card0 card1 card2 card3 # cdev, laptop sh MAKEDEV pass4 xpt2 # cdev, CAM sh MAKEDEV i4b i4bctl i4btrc0 i4btrc1 # cdev, ISDN sh MAKEDEV i4btel0 i4btel1 i4bteld0 i4bteld1 # cdev, ISDN @@ -1219,8 +1220,11 @@ gsc*) apm*) chr=39 mknod apm c $chr 0 + mknod apmctl c $chr 8 chgrp operator apm + chgrp operator apmctl chmod 660 apm + chmod 660 apmctl ;; card*) diff --git a/etc/etc.i386/rc.i386 b/etc/etc.i386/rc.i386 index 219eb09f6d7a..a131d16da0c8 100644 --- a/etc/etc.i386/rc.i386 +++ b/etc/etc.i386/rc.i386 @@ -1,6 +1,6 @@ #!/bin/sh - # -# $Id: rc.i386,v 1.38 1999/01/29 18:09:38 yokota Exp $ +# $Id: rc.i386,v 1.39 1999/01/30 07:22:29 newton Exp $ # Do i386 specific processing # @@ -10,6 +10,10 @@ if [ "X$apm_enable" = X"YES" ] ; then apmconf -e > /dev/null 2>&1 fi +if [ "X$apmd_enable" = X"YES" ] ; then + echo -n ' apmd'; apmd +fi + # Start the SCO binary emulation if requested. if [ "X${ibcs2_enable}" = X"YES" ]; then echo -n ' ibcs2'; ibcs2 > /dev/null 2>&1 diff --git a/etc/rc.resume b/etc/rc.resume new file mode 100755 index 000000000000..a794a8d9ef5c --- /dev/null +++ b/etc/rc.resume @@ -0,0 +1,23 @@ +#!/bin/sh +# +# $Id: rc.resume,v 1.1.1 1999/07/09 01:34:57 iwasaki Exp $ +# +# sample run command file for APM Resume Event + +if [ -f /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 +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 + +logger -t apmd resumed at `date +'%Y%m%d %H:%M:%S'` +sync && sync && sync + +exit 0 + diff --git a/etc/rc.suspend b/etc/rc.suspend new file mode 100755 index 000000000000..b60c2cf1719f --- /dev/null +++ b/etc/rc.suspend @@ -0,0 +1,27 @@ +#!/bin/sh +# +# $Id: rc.suspend,v 1.1.1 1999/07/09 01:34:57 iwasaki Exp $ +# +# sample run command file for APM Suspend Event + +if [ -f /var/run/rc.suspend.pid ] +then + exit 1 +fi + +echo $$ > /var/run/rc.suspend.pid + +# If you have troubles on suspending with PC-CARD modem, try this. +# See also contrib/pccardq.c (Only for PAO users). +#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'` +sync && sync && sync +sleep 3 + +rm -f /var/run/rc.suspend.pid +zzz + +exit 0 +