Subject: dialin/dialout
To: David Seifert <seifert@sequent.com>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 03/21/1998 17:35:19
>You need to open the device in two different ways.
>What could be cleaner than supplying a flag to the open(2) call?
>
>Rather than *ignoring* carrier detect, the better way is to *reverse*
>the test when opening for dialout:

Brilliantly sneaky.

But wouldn't this totally break using a line as mostly-CLOCAL, but
hooking a GPS pulse-per-second output up to the tty modem leads and
synchronizing the system clock to the modem control line? I think it's
ususally DCD.

hmm, someone should pass that by Charles while he's working on this,
so we can add a tty flag to call hardpps() on modem transitions.
If memory serves,  all the lowlevel code has to do is:


	/* ... carrier transition detetced */
#ifdef PPS_SYNC
	if (/* PPS enabled on this line*/) {
		struct timeval tv;
		microtime(&tv);
		/*  XXX assumes tv_usec set from hardware counter */
		hardpps(&tv, tv.tv_usec);
	} else
	/* normal TTY processing */
#endif

(or see FreeBSD 3.0 snapshots which use a parallel port line for the
same thing.)

Obtaining good clock discipline is latency-sensitive; if at all
possible this should go in the lower-level hardware-dependent code,
rather than the MI tty driver layer.