[LinuxPPS] Occasionally ntpd stops receiving NMEA data
Rodolfo Giometti
giometti at linux.it
Mon Jun 5 15:17:26 CEST 2006
On Mon, Jun 05, 2006 at 01:19:55PM +0200, Udo van den Heuvel wrote:
>
> LINUXPSS_API is the variable to be checked by ntp.
> (i.e.: do we have LinuxPPS? to include the header files)
I don't think NTP should check against LINUXPSS_API. It should check
against PPS_API_VERS_1 or PPS_API_VERS_2 instead.
LinuxPPS is just an implementation of PPS API, so we should declare
the PPS API supported with a define like PPS_API_VERS_x and the
particular PPS implementation with the define LINUXPSS_API.
> Later ntp can check for PPS_API_VERS, PPS_API_VERS_1 or PPS_API_VERS_2
> (see how messy this gets).
I agree.
> Just PPS_API_VERS which can be either 1 or 2 for now should be enough.
>
> Just send in a patch to the ntp folks and *maybe* the next release will
> behave differently.
This is a possibility but I don't think NTP folks will accept
something like this... they also refused modifying PPS API in order to
consider non serial connected GPS antennas...
> Then, when PPS_API_VERS 3 comes around there's less trouble.
I agree.
> Can we skip stuff like this and concentrate on the issues I posted about
> earlier?
> Like simplifying and minimizing the changes to the ntp code?
This stuff are important in my opinion, since future patches will
depend on these defines.
> Maybe put a function layer in between so there's no changes needed?
> (for the not LinuxPPS-aware applications)
About this topic I think we should open a new thread. However just to
init the discussion, here my proposal:
1) we should implement a new function:
int time_pps_findpath(char *path, int pathlen);
2) The user should define a _symbolic_ link into his/her system as
follow:
$ ln -s /dev/ttyS0 /dev/pps0
symbolic links don't require pointed file existence.
3) The drivers' patch should do something like this:
+#ifdef PPS_HAVE_FINDPATH
+ /* Get the PPS source's real name */
+ fd = readlink(PPS_DEVICE, path, LINUXPPS_MAX_NAME_LEN);
+ if (fd <= 0) {
+ msyslog(LOG_ERR, "refclock: PPS source \"%s\" is not a valid link", PPS_DEVI\CE);
+ return (1);
+ }
+ /* Try to find the source */
+ fd = time_pps_findpath(path, fd);
+ if (fd < 0) {
+ msyslog(LOG_ERR, "refclock: cannot find PPS source \"%s\" in the system", PPS_DEVICE);
+ return (1);
+ }
+ msyslog(LOG_INFO, "refclock: found PPS source \"%s\" at id #%d on \"%s\"", PPS_DEVICE, fd, id);
+#endif /* PPS_HAVE_FINDPATH */
+
+
if (time_pps_create(fd, &pps_handle) < 0) {
- pps_handle = 0;
msyslog(LOG_ERR,
"refclock: time_pps_create failed: %m");
}
Define PPS_DEVICE may be init as follow:
#define PPS_DEVICE "/dev/pps0"
In this manner we can surely address the right PPS device.
What do you think about it?
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: 191 bytes
Desc: Digital signature
Url : http://ml.enneenne.com/pipermail/linuxpps/attachments/20060605/b9cf3c64/attachment-0001.pgp
More information about the LinuxPPS
mailing list