home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 February
/
PCWorld_2000-02_cd.bin
/
live
/
etc
/
pcmcia
/
serial
< prev
next >
Wrap
Text File
|
1999-10-31
|
2KB
|
88 lines
#!/bin/bash
#
# serial 1.30 1999/06/09 17:11:12 (David Hinds)
#
# Initialize or shutdown a PCMCIA serial device
#
# The first argument should be either 'start' or 'stop'. The second
# argument is the base name for the device.
#
# The script passes an extended device address to 'serial.opts' in the
# ADDRESS variable, to retrieve device-specific configuration options.
# The address format is "scheme,socket,instance" where "scheme" is the
# PCMCIA configuration scheme, "socket" is the socket number, and
# "instance" is used to number multiple ports on a single card.
#
if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
# Get device attributes
get_info $DEVICE
# Load site-specific settings
ADDRESS="$SCHEME,$SOCKET,$INSTANCE"
. $0.opts
# Debian does not use the "cua" devices
CALLOUT=$DEVICE
case "$ACTION" in
'start')
if [ ! -c /dev/$DEVICE ] ; then
cd /dev ; ./MAKEDEV $DEVICE
fi
if [ "$LINK" ] ; then
mv -f $LINK $LINK.O 2>/dev/null
if uname -r | grep -q '^2\.[2345]' ; then
ln -s /dev/$DEVICE $LINK
else
ln -s /dev/$CALLOUT $LINK
fi
fi
if [ "$SERIAL_OPTS" ] ; then
setserial /dev/$DEVICE $SERIAL_OPTS
fi
if [ "$INITTAB" ] ; then
echo "S$NR:12345:respawn:$INITTAB $DEVICE" >> /etc/inittab
telinit q
fi
;;
'check')
fuser -s /dev/$DEVICE /dev/$CALLOUT $LINK && exit 1
;;
'cksum')
chk_simple "$3,$SOCKET,$INSTANCE" || exit 1
;;
'stop')
if [ "$INITTAB" ] ; then
fgrep -v $DEVICE /etc/inittab > /etc/inittab.new
mv /etc/inittab.new /etc/inittab
telinit q
fi
fuser -s -k /dev/$DEVICE /dev/$CALLOUT $LINK
rm -f $LINK ; mv -f $LINK.O $LINK 2>/dev/null
;;
'suspend')
fuser -s -k -STOP /dev/$DEVICE /dev/$CALLOUT
;;
'resume')
if [ "$SERIAL_OPTS" ] ; then
setserial /dev/$DEVICE $SERIAL_OPTS
fi
fuser -s -k -CONT /dev/$DEVICE /dev/$CALLOUT $LINK
;;
*)
usage
;;
esac
exit 0