#!/bin/sh # # serial 1.6 2000/12/15 19:39:01 (David Hinds) # # Initialize or shutdown a PCMCIA parallel 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 'parallel.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 LP="lp$MINOR" case "$ACTION" in 'start') [ "$VERBOSE" -a "$INFO" ] && echo "$INFO" if [ ! -c /dev/$LP ] ; then log mknod /dev/$LP c $MAJOR $MINOR fi if [ "$LINK" ] ; then if [ -L $LINK ] ; then rm $LINK ; fi log ln -s /dev/$LP $LINK fi if [ "$LP_OPTS" ] ; then log tunelp /dev/$LP $LP_OPTS fi ;; 'check') is_true $NO_CHECK && exit 0 do_fuser -s /dev/$LP /dev/$LP $LINK && exit 1 ;; 'cksum') chk_simple "$NEW_SCHEME,$SOCKET,$INSTANCE" || exit 1 ;; 'stop') do_fuser -k /dev/$LP $LINK > /dev/null if [ -L "$LINK" ] ; then rm $LINK ; fi ;; 'suspend') do_fuser -k -STOP /dev/$LP > /dev/null ;; 'resume') if [ "$LP_OPTS" ] ; then tunelp /dev/$LP $LP_OPTS fi do_fuser -k -CONT /dev/$LP $LINK > /dev/null ;; *) usage ;; esac exit 0