[LinuxPPS] Locking problem?

clemens at dwf.com clemens at dwf.com
Wed Feb 4 05:56:04 CET 2009


I have been playing with this all evening, and have a bit more
information.  Hopefully, this points to a place in the patch where
some work needs to be done.

(1) If I reboot to get everything to a clean initial state, and
    then run ppsldisc, which only opens the file and then does
    the ioctl to change to N_PPS,
    and then run my ppsapitest12, which opens the serial file, does a TIOCGETD
    tp determine that the ldisc=N_PPS, then open the pps file, run 
    time_pps_create and friends, I get timehacks...

If however
(2) I reboot, then open the serial file, do the TIOCGETD and determine
    that the file is a N_TTY, do some stats/tcgetattr/tcsetattr
    before finally doing the TIOCSETD to set the line discipline,
    when I open the pps file and run time_pps_creat and friends, 
    I get ONE timehack, and the clock is stopped.

Now, the way things have been going tonight, there is no guarantee
that I will see the same thing tomorrow, but thats what makes this
job fun :-)

Since NTPD fools around with the serial file doing these same
operations, I will assume thats why I have been having trouble
there,- but again there seems to be a time variable in all of 
this too.  Sometimes NTPD would start on this machine, and it
always starts on my 2nd machind so it feels like the delay between
some of these operations is important.

Mumph.

Anyone fmiliar with the patch have any comments on the above?
Note that the tcgetattr/tcsetattr are probably necessary to set
the tty speed for the GPS (serial) data so you cant just ignore
them.  The stat is there to see if the serial/pps devices
are the SAME device, as is possible on other systems (FreeBSD)
and without Linux Specific code would be hard to eliminate.

Enough for now.

-- 
                                        Reg.Clemens
                                        reg at dwf.com





More information about the LinuxPPS mailing list