chris@mimsy.UUCP (Chris Torek) (09/22/88)
In article <324@mikros.systemware.de> stefan@mikros.systemware.de (Stefan Stapelberg) writes: >I would like to implement this scheme, but controlling the >DTR signal from the modem turns out to be a problem: The modem >doesn't answer rings if DTR has not been asserted by the opening >process. Unfortunately, I have to use DTR to hangup the modem >after dialing out. > >So my question is: If getty's open has asserted DTR high and >uucico's last close sets DTR to low, how can I ensure that the >modem still will answer rings? Simple: in the kernel, the pending open from getty runs again, re-raising DTR. The code looks like this: ttyopen: ... switch (mode) { case DIAL_IN_MODE: /* * Assert DTR and wait for carrier, * but do nothing while the line is * tied up in `dialout' mode. */ for (;;) { if (!active_in_dialout()) assert_dtr(); wait_for_carrier(); if (active_in_dialout()) wait_for_status_change(); else break; } set_active_in_dialin(); /* now ready to use */ break; case DIAL_OUT_MODE: /* * Error if busy, else assert DTR and * open immediately. */ if (active_in_dialin() || active_in_dialout()) return (EBUSY); set_active_in_dialout(); assert_dtr(); /* now ready to use */ break; } and ttyclose: ... switch (mode) { case DIAL_IN_MODE: /* * Close down dial-in edition and * hang up if we should (`hupcls'). */ clear_active_in_dialin(); maybe_clear_dtr(); break; case DIAL_OUT_MODE: /* * Close down dial-out edition and * hang up no matter what, then delay * for about a second for the modem * to see DTR fall. */ clear_active_in_dialout(); clear_dtr(); sleep(1_second); break; } /* * Wake up anyone in the `other' mode * in case someone wants to reassert DTR. */ status_change(); -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris
dag@fciva.FRANKLIN.COM (Daniel A. Graifer) (09/29/88)
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/$DEVICE >/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