Subject: Re: is TIOCMGET supposed to reflect reality?
To: None <tech-kern@netbsd.org>
From: Tom Yu <tlyu@mit.edu>
List: tech-kern
Date: 09/27/2004 09:50:18
>>>>> "David" == David Laight <david@l8s.co.uk> writes:

>> Is there any reason not to always enable DCD and CTS interrupts?  I
>> gather that there might be performance reasons for disabling DCD and
>> CTS interrupts, but if the interrupts are disabled, TIOCMGET would
>> have to explicitly read RR0 to get the correct state of the modem
>> status lines.

David> If either of them are disconnected at the far end of a serial cable
David> then, because of cross-talk between the and because the cable acts as
David> an antenna, you get lots (and I means lots) of transitions on the
David> modem signallines.

That's an interesting point.  I notice that com.c always enables modem
status interrupts on the 8250/16405/16550 UARTs.  Do line drivers
attached to PC UARTs tend to be biased in a way that makes the modem
status lines less susceptible to noise?  Or are PCs fast enough these
days that nobody cares about stray modem status interrupts? :-)

Also, at some point in the past (around rev 1.39), z8530tty.c did have
DCD_IE and CTS_IE unconditionally enabled, but there was a change in
rev 1.53 to only enable them if the tty layer expects to track the
status lines.  It looks like this change was in response to some
problems on mac68k machines.

David> Even if you need these interrupts, the code should poll the signal
David> for one of the transitions in order to do software debounce.

There's some stuff in the Zilog documentation about how the modem
status bits in RR0 get latched when the corresponding interrupts are
enabled, though I don't think I quite understand the details.

---Tom