[LinuxPPS] 17Jun Patch

clemens at dwf.com clemens at dwf.com
Tue Jun 24 20:28:10 CEST 2008


> Lines discipline work as follow:
> 
> 1) At serial port open the default ldisc is N_TTY. At close the
> currently selected ldisc is switched automagically to N_TTY again.
> 
> 2) The only one that may select the ldisc is the only one that needs
> it: that is NTPD. You should modify the NTPD code in order to call
> something like:
> 
> #ifdef N_PPS
> 	ldisc = N_PPS;
> 	ret = ioctl(fd, TIOCSETD, &ldisc);
> 	if (ret < 0) {
> 		P_WARN("unable to set line discipline \"%d\" for device \"%s\" (%m)", ldisc, dev);
> 		P_WARN("hope it's ok...");
> 	}
> #endif
> 
> after accessing the serial port and before accessing the PPS device.
> 
> NTPD guys should accept it since line disciplines are across several
> UNIX implementation:
> 
>    http://en.wikibooks.org/wiki/Serial_Programming:Unix/V7#Line_Discipline
> 

I started this thread, and didnt think it was going to continue as it has.
First, the above solution is very nice, but I am just as happy using ttyctrl.
My only complaint was that it hangs around, and this is not necessary.
Once the line discipline is set it is going to stay set till the final close 
of the device.
So, if there were an option to set the line discipline to N_TTY with ttyctrl, 
and then wait say 30-60seconds before
exiting, this could be done in the ntpd startup script, and ntpd would start, 
open the device and hold
the line discipline until it itself exited.

Seems cleaner than the multiple places that ntpd itself would have to be 
modified (every driver that
opens a pps device).

Anyone see a problem with that?

-- 
                                        Reg.Clemens
                                        reg at dwf.com





More information about the LinuxPPS mailing list