[ntp:hackers] Further to the serial port looping thing

David L. Mills mills at udel.edu
Thu Apr 28 12:01:17 PDT 2005


Guys,

I chased down the ultimate source of the looping behavior described in a 
previous post. By default the serial port is set to local mode (CLOCAL). 
A test is done in refclock_setup() to see if the data set ready (DSR) 
interface bit is lit and, if so, switches to remote mode. It's been this 
way since 1992 and is required in some kernels (Tru64 being one) for the 
modem control bits to work prperly, in particular the CD bit for the PPS 
signal.

On some kernels (FreeBSD being one) and some motherboardsi, setting DSR 
causes an unclearable interrupt. This is probably a bug in the kernel 
serial port driver with some flaky 16550 UART chip. I have two Pentia 
that have this problem and four that do not. It does not help to delay 
between opening the device and fiddling the termios bits.

I looked over the others in the driver collection and found a few that 
do diddle the modem control bits. At least in some kernels these drivers 
won't work in local mode, so some means in necessary to reliably 
determined whether to use local or remote mode. It's a bit tricky, since 
the driver developers have proably never read and understood the 1964 
Bell 103 specification that defined the modem control state machine. I 
do know that Digital understood it and implemented correctly.

I plan to invent a LDISC_REMOTE bit in the refclock_open() call that 
specifically enables the DSR function; otherwise, it will default off. 
For those drivers that need modem control, including the acts, neoclock, 
parse, heath, hopfser and palisade, this bit should be included in the 
open call.
I will so change the acts and heath drivers, but I don't own the others. 
Unless somebody tells me not to, I will wait a couple of days and change 
them, too.

Dave








More information about the hackers mailing list