From: andrew@werple.pub.uu.oz.au (Andrew Herbert)
Newsgroups: comp.unix.sysv386
Subject: svr4 asy, uucico and ttymon hints (was: Sys V R4, Async problems...)
Keywords: svr4, asy, uucico
Date: 6 Apr 92 12:45:17 GMT
Organization: Werple public-access Unix, Melbourne

Following is information on getting UNIX System V Release 4 BNU services,
and incoming modem sessions, working with the (USL) standard asy device driver.
At least some of it would probably be of use in the FAQ document...

chert@dungeon.cirr.com (Chert Pellett) writes:

[stuff about svr4 dialout problems and ttymon deleted]

For people using the standard USL svr4 asy driver (e.g., MST and UHC), the
asy devices are as follows:
    /dev/term/00, /dev/term/00s
	These access the software flow-controlled serial port 0.  This ignores
	the serial port's modem control lines.  Not recommended for modems!

    /dev/term/00h
	This is the hardware flow control version of the above.  This device
	blocks when carrier detect is low, and only sends output over the port
	when CTS is high (at least, that is the default control line used).
	To bypass this blocking, the device needs to be opened in non-blocking
	mode and sent a CLOCAL termio call.  This is done by programs such as
	c-kermit 5a(176) [ftp from cc.columbia.edu, I seem to remember] and
	svr4's cu and uucico.  This control style should normally be used
	with modems.

Note that only one of the above should be opened for any port number because
an open of one blocks the other.  Of course, the same goes for /dev/term/01,
etc.

The problem many people (including me!) appear to have with svr4 is getting
uucico (and cu, if you must) to dialout on hardware flow controlled lines
(which you really need to use if accepting incoming calls too, to allow HUP
handling).  The key to getting this to work is putting a line in
/etc/uucp/Devices like:

	ACU term/00h,M - 19200 hayes

where "hayes" is the dialer type associated with the port /dev/term/00h, and
"M" sets the tty to CLOCAL mode (to initially ignore carrier detect from the
modem).  Without the "M", uucico and cu block while CD is low.

Then, in /etc/uucp/Dialers, add a corresponding entry something like:

	hayes   =,-,    "" \M\pAT\r\c OK\r \EATDT\T\r\c CONNECT \m\c

The /M and /m change to clocal and -clocal respectively (the \M in this line
is probably redundant, but what the heck!).

And you're all set!

For incoming calls, set up ttymon to monitor /dev/term/00h (sysadm is probably
easiest for this).  ttymon will keep off devices that are locked by means of
a file in /var/spool/locks.  This is how uucico/cu/kermit/ttymon share a
single tty device.

Only problem is, if your ttymon is anything like mine (UHC SVR4 version 2.0),
a ttymon will occasionally be spawned immediately after an incoming call
finishes; this blocks any outgoing calls until it is killed (kill $pid works
pretty well here :).

For those unfamiliar with ttymon, here is a quick rundown...  ttymon is a
replacement for (uu)getty, and also incorporates some of the traditional
functionality of init.  A ttymon process is started at system boot time, much
as would be a getty or two (or five or six...).  However, a single ttymon
can monitor up to 1000 or so ttys, making ttymon quite elegant compared with
having millions of getty processes sleeping everywhere.  When CD goes high
on one of the ports the ttymon is listening to and that port isn't already
in use (determined by looking in /var/spool/locks) it spawns a child to handle
the port.  A utmp (and utmpx) entry can be automatically created (as with
getty) and a arbitrary program execed (e.g., /usr/bin/login, most of the
time).  On hangup, the parent ttymon cleans up utmp.  I believe wtmp and wtmpx
are also handled by ttymon.

Finally, I'd recommend against using fas until it becomes a streams driver -
you lose too much.  And if you're having trouble getting asy to recognise
NS16550AFN-based ports, I'm happy to mail out information on the horrible
hack I did to the *very* strange initialisation routine in this driver.

Hope this helps,
Andrew Herbert
andrew@werple.pub.uu.oz.au or andrewh@molly.cs.monash.edu.au