Subject: Re: pb with com port , pppd and tip on NetBSD 1.0
To: Thierry Leconte <tmm@mcci.com (Terry Moore), Thierry.Leconte@irisa.fr>
From: Brian Buhrow <buhrow@cats.ucsc.edu>
List: port-i386
Date: 05/08/1995 13:36:43
	I also have written a patch for the com.c file which allows 
in-kernel dial in/out devices.  This patch has been very well receivd by
those who have requested it from me.  It currently only is for 1.0, but I'm
told it applies rather neatly to the -current com.c as well.
Here is the readme.  If you are interested in the code, mail  me privately.
-Brian

	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