[LinuxPPS] ntpd
Rodolfo Giometti
giometti at linux.it
Thu Aug 3 11:15:36 CEST 2006
On Wed, Aug 02, 2006 at 08:08:56PM +0200, Udo van den Heuvel wrote:
>
> BTW: I was looking at the time_pps_findpath function but do not yet
> really understand it. There is a PPS device defined like "/dev/ttyS2" or
> similar but where does that info enter the code? What does the function
> look for to know what port/device I want ntpd to use as a timesource?
The time_pps_findpath() can be use to say to the NTPD daemon which is
the PPS source you wish to use. Example (maybe it can help Folkert :),
I have a GPS antenna connected to ttyS1, if the NTPD uses:
fd = time_pps_findsource(-1, path, 40, id, 40);
the system will return the _first_ available PPS source (due "-1") so,
using 8250 client, it is ttyS0! This because the client defines a PPS
source for _each_ serial line in the system (it cannot know which
serial line the user will use for his/her GPS antenna).
The only way to force time_pps_findsource() to return the PPS source
on ttyS1 is by using:
fd = time_pps_findsource(1, path, 40, id, 40);
or whatever "id" ttyS1 has into /proc/pps/sources. This imply to
modify the code...
On the other hand if you use time_pps_findpath() as described into the
wiki you can say to the NTPD which is your PPS source by doing a
simbolic link. I report below the example in the wiki:
giometti at jeeg:~/linuxpps$ cat /proc/pps/sources
id mode echo name path
---- ------ ---- ---------------- ----------------
00 1151 yes ktimer
01 1133 no pps_8250_0 /dev/ttyS0
02 1133 no pps_8250_1 /dev/ttyS1
03 1133 no pps_8250_2 /dev/ttyS2
04 1133 no pps_8250_3 /dev/ttyS3
giometti at jeeg:~/linuxpps/test$ sudo ln -sf /dev/ttyS1 /dev/gps0
giometti at jeeg:~/linuxpps/test$ sudo ./ppstest /dev/gps0
found PPS source #2 "pps_8250_1" on "/dev/ttyS1"
giometti at jeeg:~/linuxpps/test$ sudo ln -sf ktimer /dev/gps0
giometti at jeeg:~/linuxpps/test$ sudo ./ppstest /dev/gps0
found PPS source #0 "ktimer" on ""
As you can see I can switch PPS sources by simply redefining the
symbolic link _without_ changing the code! :)
Ciao,
Rodolfo
--
GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at gnudd.com
Embedded Systems giometti at linux.it
UNIX programming phone: +39 349 2432127
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://ml.enneenne.com/pipermail/linuxpps/attachments/20060803/502f5475/attachment-0001.pgp
More information about the LinuxPPS
mailing list