Path: utzoo!utgpu!attcan!uunet!fciva!dag
From: dag@fciva.FRANKLIN.COM (Daniel A. Graifer)
Newsgroups: comp.dcom.modems
Subject: driver supporting dialin/dialout on same device
Keywords: modems ACU driver
Message-ID: <427@fciva.FRANKLIN.COM>
Date: 29 Sep 88 12:34:15 GMT
References: <13680@mimsey.uucp> <1888@van-bc.UUCP>
Organization: Franklin Capital Investments, McLean, Va.
Lines: 119

In the above referenced articles, which have expired on my system,
chris@mimsey (Chris Torek) and sl@van-bc (Sturart Lynne) write 
regarding devices drivers that support dialin and dialout on the 
same device.

My Prime EXL316 has the Sun-like implimentation where adding 128 to
the minor number of the device gives you the same device, but with
modem controls.  I have, however been having the same problem as 
jgp@moscom.UUCP (Jim Prescott) in that uucico and cu leave DTR off
while the uugetty on the modem version of the line continues to 
sleep waiting for the modem to answer the phone.

It seems to me that the correct solution for this is in uucico and
cu:  They should return the line to the state they found it in when
they are finished.  Since I don't have a source license here, I've
had to find other solutions.  The clue was noticing that doing an
stty on the non-modem device caused DTR to be turned back on.  I
wrote a shell script that sleeps for a while, then looks to see if
there are any locks on the non-modem device.  If not, it does an
stty on it, and goes back to sleep.  Most of the code below is
for getting me a log of what's going on.

My devices are:

crw-r--r--   1 uucp     sys        3, 31 Sep 29 08:09 /dev/tty1f
crw--w--w-   1 uucp     sys        3,159 Sep 27 10:05 /dev/tty1fm

My inittab entries are:

1F:2:respawn:/usr/lib/uucp/uureset -l /dev/console -t 180 tty1f 
1Fm:2:respawn:/usr/lib/uucp/uugetty -r -t 60 tty1fm h19200 # TelebitTrailblazer+

Below is a listing of my "uureset" shell script.  I started it last night at
19:00, and it worked flawlessly through all my overnight transfers, using 
about 28 seconds of processor by 7:00 this morning.  Hope this helps people
until the vendors get this fixed.

	Dan

Daniel A. Graifer			Franklin Capital Investments
uunet!fciva!dag				7900 Westpark Drive, Suite A130
(703)821-3244				McLean, VA  22102

---- cut here ----
#!/bin/sh
#ident	"@(#)uureset	1.0  (FCI) 9/28/88"

#This shell checks whether a given tty device has a lock file associted
#with it.  If not, it does an stty on the line to cause DTR to come up
#if it is down.  It then sleeps for a while, then repeats.   It should
#be respawned by init on lines that have paired uugetty on ttyxxm and
#cu/uucico on ttyxx.  This is a temporary fix to the problem of the 
#latter processes leaving DTR off when they are done.
#Written by Dan Graifer

SLEEP=120
LOG=/dev/null
LOGGING=`false`
USAGE="usage: uureset [-t sleeptime] [-l logfile] devname"

while getopts t:l: c
do
	case $c in
	t)	SLEEP=$OPTARG;;
	l)	LOGGING=`true`
		LOG=$OPTARG;;
	\?)	echo $USAGE
		exit 2;;
	esac
done
shift `expr $OPTIND - 1`

DEVICE=$1
if [ ! -c "/dev/$DEVICE" ]
then
	echo "Device Not Found: $DEVICE" >>$LOG
	exit 2
fi

while true
do
	sleep $SLEEP
	if [ ! -s "/usr/spool/locks/LCK..$DEVICE" ]
	then
		stty /dev/null 
		rslt=$?
		if [ 0 != $rslt ]
		then
			if $LOGGING
			then
				echo "`date` $DEVICE reset failed ($rslt)" >>$LOG
			else
				exit 2
			fi
		else
			if $LOGGING
			then
				echo "`date` $DEVICE reset" >>$LOG
			fi
		fi
	else
		if $LOGGING
		then
			PID="`cat /usr/spool/locks/LCK..$DEVICE`"
			WHO=`ps -f -p $PID |tail -1l`
			if [ -n "$WHO" ] 
			then
				echo "`date` $DEVICE owned by ($PID) $WHO" >>$LOG
			else
				echo "`date` $DEVICE left locked by $PID" >>$LOG
			fi
		fi
	fi
done

-- 
Daniel A. Graifer			Franklin Capital Investments
uunet!fciva!dag				7900 Westpark Drive, Suite A130
(703)821-3244				McLean, VA  22102