Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Jeff Sturm <jsturm@gatecom.com>
To: axp-list@redhat.com
Subject: Re: ttyS0 versus cua0
Date: Fri, 11 Sep 1998 10:04:52 -0400 (EDT)	[thread overview]
Message-ID: <Pine.SV4.3.90.980911094005.7629A-100000@gatecoms> (raw)
In-Reply-To: <19980910080221.A10774@xcski.com>


On Thu, 10 Sep 1998, Paul Tomblin wrote:
> Now this is weird.  After my problems with lightning, and taking apart and
> putting back together all the cables and reseating all the boards and
> everything, the vt220 terminal I have hung off of ttyS0 wasn't working.  Even
> a simple experiment like "echo foo > /dev/ttyS0" or "stty -a < /dev/ttyS0"
> would just hang forever.  But doing the same thing to /dev/cua0 worked fine.
> And the modem on /dev/cua1 works fine too.  So I changed my inittab (for the
> first time in years) to start the getty on cua0 instead of ttyS0, and
> everything works.
> 
> Can anybody explain why cua0 would work when ttyS0 doesn't?  I thought they
> were basically the exact same kernel driver, but the "cua0" had some extra
> locking logic for the benefit of uucp?

The ttyS0 port by default observes modem control signals, which prevent 
open() from completing until CD/DTR (IIRC) is raised.  The workaround is 
to use "stty -clocal" which configures the port to ignore modem control.  
The catch-22 is that "stty -clocal </dev/ttyS0" will hang forever on a 
blocking open.

(This brings back painful memories of installing hardwired terminals 
before Ethernet was common and Linux ever got out of Finland.)

The terminal *should* raise DTR and activate the port when switched on, 
but several things can get in the way: the terminal could be configured 
to never raise DTR, the RS/232 cable might be incomplete/malfunctioning 
(terminals were often wired with just 3 conductors, RX/TX/GND), or the 
serial port could possibly be malfunctioning.

Often I diagnosed these problems with a RS/232 line analyzer.  One 
favorite trick of mine is to open the serial port with something like "cu -l 
ttyS0", type a sentence, and see if it appears on the terminal console.  
Normally this works even without modem signals since cu does a non-blocking 
open().

One workaround is "stty -clocal" if you can open the port at all (I once 
wrote a small C program just to do this).  Another is to modify the 
cable, shorting together the DSR/DTR/CD pins on the host side only, so it 
thinks the terminal is on and ready all the time.

(All my experience with hardwired terminals was back with AIX, HP/UX and 
SCO.  I have no idea how much of this applies to Linux, since I've never 
plugged a terminal into Linux.  Boy how I love Ethernet :) )


Jeff


  parent reply	other threads:[~1998-09-11 14:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-10 12:02 ttyS0 versus cua0 Paul Tomblin
1998-09-10 17:49 ` Christopher Curtis
1998-09-10 17:56   ` Randy Carpenter
1998-09-10 17:57   ` Paul Tomblin
1998-09-10 18:00     ` Paul Tomblin
1998-09-10 17:53 ` Michal Jaegermann
1998-09-10 17:59   ` Paul Tomblin
1998-09-10 18:15     ` Michal Jaegermann
1998-09-10 18:32       ` Paul Tomblin
1998-09-10 18:38         ` Daniel Stringfield
1998-09-10 18:53           ` Paul Tomblin
1998-09-12  7:35             ` gkoch
1998-09-11 10:41       ` Peter Waltenberg
1998-09-10 22:43         ` Paul Tomblin
1998-09-11 14:29     ` kernel debugger ward
1998-09-10 18:40 ` ttyS0 versus cua0 Bibek Sahu
1998-09-11 14:04 ` Jeff Sturm [this message]
1998-09-11 14:52   ` Paul Tomblin
1998-09-11 14:55   ` Paul Tomblin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox