[LinuxPPS] multiple access to /dev/ppsN entries

Bernhard Schiffner bernhard at schiffner-limbach.de
Wed Mar 17 19:21:09 CET 2010


On Wednesday, 17. March 2010 18:15:36 Miroslav Lichvar wrote:
> On Wed, Mar 17, 2010 at 10:52:03AM -0600, clemens at dwf.com wrote:
> > > I _think_ that I need to have multiple processes accessing the same
> > > /dev/ppsN entry -- I'm hoping that you will offer your expert opinion
> > > as to whether this is possible.
> > 
> > I have run both ntp and my test program at the same time, so there is
> > no problem with two separate programs opening /dev/pps0
> 
> Unless they set the PPS parameters differently, the first started
> application could be receiving something else than it's expecting.

Miroslav,

because I'am a little bit out of business here: does cat /dev/pps* return 
nowadays something usefull?
IIR it is intended as a container for functioncalls (RCF2783) and does provide 
-EINVAL to a normal read(2).

I used a patch from George Spelvin and was _very_ happy to have a (multi) 
readable  /dev/pps*.

It starts with 
http://ml.enneenne.com/pipermail/linuxpps/2009-February/002831.html

and George sent me (later, PM) his patch-queue against 2.6.32-rc6. If there is 
interest in, I'll ask him to post this to the list.


Bernhard

PS:
This is a snippet of a mail (Mar 2009) to John Stulz asking for advise 
regarding how to proceed and a good format of output.

...
1.) When the N_PPS line discipline is set for a serial port, it creates 
/dev/ppsN.
2.) NTPD as the main user communicates with LinuxPPS using function calls as 
    described by RFC 2783.
3.) The function calls don't map on to a byte stream very well, so use some 
magic
    ioctls on the file descriptor.
4.) Until now, any normal read(2) on the device would return -EINVAL.
5.) George and me want to have a readable output instead. George wrote the 
code. 
6.) The format is simply <edge> <sequence> <timestamp>, output as they occur 
e.g.:
        assert 577917 1236209879.010016955
        clear 577917 1236209879.011017749
        assert 577918 1236209880.010017092
        clear 577918 1236209880.011017869
        assert 577919 1236209881.010016803
        clear 577919 1236209881.011007849
        assert 577920 1236209882.010008678
        clear 577920 1236209882.011013022
        assert 577921 1236209883.010017007
        clear 577921 1236209883.011017819
    (Per the RFC, the sequence numbers are independent for the two edges.  
Their
    purpose is to detect missed events when polling the device.)
7.) RFC 2783 has nothing to say on the subject; it just requires that you open
    some device and can use the function call interface.
8.) Think of gnuplot and R as applications using this output. Or simply the 
    ease of testing.  (Tests are done today by a "complicated" cat to 
/sys/class/pps/...)
...



More information about the LinuxPPS mailing list