Subject: bidirectional lines on i386 com ports for 1.0 (now available)
To: None <current-users@NetBSD.ORG>
From: Brian Buhrow <buhrow@cats.ucsc.edu>
List: current-users
Date: 01/23/1995 10:19:09
	Hello fellow netbsd users.  I have a set of patches for the i386 com
driver for NetBSD 1.0 which implement callout devices.  If you want these,
mail me at:
buhrow@nfbcal.org.

Here is the readme.

	Here are the diffs necessary to use callout devices on serial ports under
NetBSD 1.0.  I have  had friends testing these diffs for over a month, and
they have been quite pleased with them.  I run an earlier encarnation of
these patches on my production system and they have been quite reliable.
That said, however, be aware that your mileage  may vary.  

HOW TO USE:
1.  Apply the enclosed diff file to /usr/src/sys/arch/i386/isa/com.c as it
comes from the 1.0 distribution set.  Use the patch program.

2.  Edit your kernel configuration file to include:
options "COM_BIDIR"

3.  For each com port that you want to have the special bidirectional
capability, edit the line so that it includes the words: "flags 2"
For example, 
device		com0	at isa? port "IO_COM1" irq 4
becomes:
device		com0	at isa? port "IO_COM1" irq 4 flags 2

	If you are using an AST multiport board, or some other board which uses
interrupt multiplexing, then you may need to specify a value of 3 for the
flags so that you disable interrupts for each uart, and take advantage of
the multiplexed interrupt vector.  

3.  Re config and build your kernel.  

4.  Saving a copy of your known working kernel in the root partition of
your
system, install your newly built kernel.  Reboot.

5.  Running on your new kernel, become root and cd /dev.
For those serial ports where you want bidirectional capabilities, use mknod
to create the callout device.  For example, to create the callout device
for com0 (tty00), use the following syntax:
mknod cu00 c 8 128

Note that the minor device number of the callout device is 128 + the minor
device number of the dial-in device.  Thus, tty01 becomes 129, tty02 becomes
130, etc.  

6.  Edit your /etc/ttys file to turn on getty on those ports where you want
people to be able to dial in.  

I use entries of the form:
tty00	"/usr/libexec/getty D19200"	unknown on rtscts

	This gives me full hardware flow control on my modem for the 
dial in line and takes advantage of the auto-baud code in getty.  Actually,
this code is very suspect, but it seems to work for me.

7.  To use the callout device, fire up kermit and set line to the name of
the callout device you created in step 5 above.  Note that you may need to
set the baud and flow control method from within kermit.

NOTES:
	This is an interim version of this patch.  That is, I know of some 
limitations inherent in this patch, but they seemed minor enough to allow
the patch to go out the door.  The largest limitation was pointed out  by
Bakul Sha (bakul@netcom.com) who pointed out that selects on the callout
device would not work under this implementation.  Also, there is a known
bug whereby if getty is waiting for carrier detect on a modem with the
bidirectional port turned on, and a process opens the call-in device in
non-blocking mode, the callout device becomes busy until getty dies and
starts a new waiting procedure.  This can happen when someone dials in on
the line or if the power on the modem is cycled.  Finally, the next 
implementation will try to use memory more conservatively.
	Although I believe this patch will cause no other conflicts in the 
NetBSD 1.0 system, you should save an original of the com.c driver in case
thingsgo badly.

	Please send comments, suggestions, bug fixes, etc. to:
buhrow@nfbcal.org