[LinuxPPS] LinuxPPS - odd behaviour. (Please Read)

clemens at dwf.com clemens at dwf.com
Thu Nov 8 19:39:49 CET 2007


> Udo van den Heuvel wrote:
> > clemens at dwf.com wrote:
> > (...)
> >> If nothing else, that's ugly.
> >> To do it auto-magically is going to take some ugly code that
> >> is Linux specific in NTP and we've tried to avoid OS specific code
> >> whenever possible.
> > 
> > That is part of what I tried to explain.
> > How/where could we fix this in the most elegant way?
> 
Hummm.
It seems the following should work, and be only a few lines of code:

    (a) you are given the names of the serial & PPS devices.
    (b) you do a readlink to find their true names (follow symbolic links if 
there)
    (c) The PPS name *must* be of the form /dev/pps<n> at this point,.
        (c1) If the PPS name is *not* of the form /dev/pps<n> go to (f)
        (c2) if /sys/class/pps/pps<n> does not exsit, go to (f), this would 
take care
               of otehr OS that dont have /sys
    (d) go read /sys/class/pps/pps<n> to get the parent device.
    (e) If the file found in (d) is not the same as the 1st file in (b) then 
open it.
    (f) done

Now, tho readlink is a POSIX function, Im not sure if its in all OS new and old
that ntp runs on.  If it is there then it could simplify the 'stat' code that 
I use
in refclock_oncore to determine if the serial and PPS devices are the same.

But, thats my cut at how it would be done with the current interface, if it 
were
compiled in. 

I may try that later this afternoon just to see how it looks.
-- 
                                        Reg.Clemens
                                        reg at dwf.com





More information about the LinuxPPS mailing list