Subject: Re: com device
To: Vadym V. Chepkov <vvc@kharkiv.net>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: port-alpha
Date: 12/26/1999 14:35:10
On Fri, 24 Dec 1999, Christos Zoulas wrote:

> In article <Pine.BSF.4.21.9912242246400.734-100000@hut.kharkiv.net>,
> Vadym V. Chepkov <vvc@kharkiv.net> wrote:
> >I looked in the /etc/ttys
> >
> ># AlphaStation NS16550 ("com") serial ports
> >ttyC0   "/usr/libexec/getty std.9600"   unknown off secure
> >ttyC1   "/usr/libexec/getty std.9600"   unknown off secure

Right. As Christos mentioned, you either need softcar or local at then end
of the line.

The root problem is that the serial port driver is waiting for a modem to
have connected to the port before proceeding (for DCD to be asserted). 
With the above changes, it won't. 

> >Looks fine
> >
> ># bash-2.03# stty < /dev/ttyC0 ; frozen :-(
> >^C
> 
> As expected

Right. The shell is opening /dev/ttyC0 for you, and it's not indicating
the driver should not wait for DCD. So the driver waits for DCD forever..

> >Ok, another try
> >
> ># stty -f /dev/ttyC0
> >ispeed 0 baud; ospeed 9600 baud;
> >lflags: echoe echoke echoctl
> >oflags: onocr onlret
> >cflags: cs8 -parenb

With the -f option, stty is making the open() call, and it tells the
driver to not wait for DCD, so it works.

> >I'd like to install special device, which I developed, on COM1, so I tried
> >to configure com-port without modem control and 2400 baud
> >
> ># stty -f /dev/ttyC0 clocal speed 2400
> >9600
> >
> ># stty -f /dev/ttyC0 - settings isn't changed :-(
> 
> As expected. Only while the file descriptor remains open the settings
> are preserved. When the file descriptor is closed, the settings revert
> to their defaults.
> 
> >What I'm doing wrong or where I can read about COM devices under NetBSD on
> >alpha?
> >
> >P.S. When I'm working on FreeBSD 
> >man sio and stty < /dev/cuaia0 2400 work very well. 
> 
> What are you trying to do?
> If you want to emulate what FreeBSD does you can:
> - edit /etc/ttys and add 'softcar' to the tty you want to use [ttyC0]
> - run (stty 2400; sleep 100000000) < /dev/ttyC0 
> - run stty -f /dev/ttyC0
> 
> Well, this is not a very useful example... Anyway...
> 
> ttys on netbsd are not like cu devices. If you want to connect to them
> while there is no carrier, you need to set softcar. If you want to keep
> the state of the tty, you need to keep a file descriptor open to it.

Take care,

Bill