Subject: strange behaviour of apmd
To: None <current-users@NetBSD.ORG>
From: Thorsten Frueauf <frueauf@ira.uka.de>
List: current-users
Date: 01/14/1997 18:30:27
Hello!
I have a Toshiba Tecra 500 CDT Laptop running NetBSD current (13.01.1997)
with the pcmcia and atapi patches installed.
Because the driver for the 3Com Etherlink 3C589C does not support the
suspend/resume mechanism I wrote two skripts for apmd:
/etc/apm/suspend:
--- schnipp ---
#!/bin/sh
SLOT=0
/sbin/ifconfig ep0 down
/sbin/pcmcia_cntrl ${SLOT} unconf
/sbin/pcmcia_cntrl ${SLOT} off
--- schnapp ---
/etc/apm/resume:
--- schnipp ---
#!/bin/sh
SLOT=0
/sbin/pcmcia_cntrl ${SLOT} on
/sbin/pcmcia_cntrl ${SLOT} probe
/sbin/ifconfig ep0 up
hostname=`cat /etc/myname`
hostname $hostname
(
tmp="$IFS"
IFS="$IFS."
set -- `echo /etc/hostname*`
IFS=$tmp
unset tmp
while [ $# -ge 2 ] ; do
shift # get rid of "hostname"
(
read af name mask bcaddr extras
read dt dtaddr
if [ ! -n "$name" ]; then
echo "/etc/hostname.$1: invalid network configuration file"
exit
fi
cmd="ifconfig $1 $af $name "
if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
cmd="$cmd broadcast $bcaddr";
fi
cmd="$cmd $extras"
$cmd
) < /etc/hostname.$1
shift
done
)
ifconfig lo0 inet localhost
route add $hostname localhost
if [ -f /etc/mygate ]; then
route add default `cat /etc/mygate`
fi
--- schnapp ---
Both scripts are 755 protected. The strange thing about apmd is, if I
suspend the system via `apm -z` and resume it afterwards, the /etc/apm/resume
script seems not to be executed.
And even more strange, sometimes (not always!) the /etc/apm/resume script is
trashed! It has the same size as before, but does only conatin 0 chars!
If I start the resume script by hand I get the network back as I intended.
So is there something broken with apmd? Or do I have to blame the pcmcia
or atapi patches?
Thanx for any help in advance!
Greets
Thorsten