[LinuxPPS] the ttyctrl program.

Cirilo Bernardo cirilo.bernardo at gmail.com
Mon Jun 23 08:34:19 CEST 2008


On Mon, Jun 23, 2008 at 6:00 AM,  <clemens at dwf.com> wrote:
> The important point here is that the line discipline change only stay
> effective as long as /dev/ttyS0 (or whatever) stays open.
>
> You can't just do ttyctrl (without -X) as the line discipline gets set, then
> goes away.  But I consider it ugly having ttyctrl hanging forever (with -X),
> and it would be worse to add code to ntpd to do this 'more elegantly'.
>
> What I would suggest would be a third option for ttyctrl, in addition to
> (nothing) and (-X).  Perhaps even -X <number> but thats really not necessary,
> just an option so that the program hangs for say 60seconds and then drops
> away.  Thats more than enough time for ntpd to start and open the device
> /dev/ttyS0, and it would get rid of this 'thing' that people are going to
> notice and ask about.  ttyctrl could then be part of the startup script for
> ntpd, rather than a once only thing.
>
> I could do that, but it would be nice if we were all playing with the same
> set of subroutines.
>

As ugly as it may be, I think the ntpd start script will have to
change the ldisc on 'start' and switch it back to N_TTY on 'stop'.   I
can't recall if the NTPD code itself ever checks what the ldisc is.

Another possible option is to have a PPS-ldisc related callback for
pps_core to call when a pps device is opened; the callback can be used
to set N_PPS on the first open and N_TTY when the last reference is
closed.  If the device does not need ldisc support, it simply uses a
'NULL' for the callback pointer.  This would be the most transparent
method and the best if it can be implemented cleanly.  The pppd code
does something similar (except of course that is a userspace program,
while the PPS thing would be in kernel space).

- Cirilo



More information about the LinuxPPS mailing list