[LinuxPPS] FW: ntp-4.2.4p0 + ntpd_nmea.patch
Udo van den Heuvel
udovdh at xs4all.nl
Mon Aug 20 18:17:53 CEST 2007
Rodolfo Giometti wrote:
> On Sun, Aug 19, 2007 at 06:31:17PM +0200, Udo van den Heuvel wrote:
>
>> I am wrestling with:
>> How to deal with io_closeclock in the case of two fd's?
>> (when a NMEA device has two devices open for NMEA and PPS)
>>
>> (this is needed to handle all cases of 1 and two devices with NMEA and PPS)
>
> I don't understand your problem... looking at file refclock_nmea.c I
> see only this io_closeclock() occurrence:
(....)
> {
> register struct nmeaunit *up;
> struct refclockproc *pp;
>
> pp = peer->procptr;
> up = (struct nmeaunit *)pp->unitptr;
> #ifdef HAVE_PPSAPI
> if (up->handle != 0)
> time_pps_destroy(up->handle);
> #endif /* HAVE_PPSAPI */
> io_closeclock(&pp->io);
> free(up);
> }
>
> and it doesn't touch up->handle at all.
It handles the shuffling of a list of clocks.
I don't have the code in my head for that io_closeclock routine but some
stuff happens that makes me wonder.
So does NMEA with and/or without PPS always appear as one clock?
(yes?)
> However I suggest to you to do something like this during open phase:
>
> #ifdef HAVE_PPSAPI
> /*
> * Start the PPSAPI interface if it is there. Default to use
> * the assert edge and do not enable the kernel hardpps.
> */
> if (time_pps_create(fd, &up->handle) < 0) {
> /* Try the alternare PPS device */
When would this fail?
When no link in /dev is present?
Other situations? (i.e.: when is a PPS device a real enough PPS device
for ntpd?)
> (void) sprintf(device, DEVICEPPS, unit);
>
> fd = open(device, O_RDWR);
> if (fd < 0)
> goto pps_error;
>
> if (time_pps_create(fd, &up->handle) < 0)
> goto pps_error;
> }
> return(nmea_ppsapi(peer, 0, 0));
>
> pps_error:
> /* No luck, no PPS unit available! */
> up->handle = 0;
> msyslog(LOG_ERR,
> "refclock_nmea: alternate PPS device %s fail : %m", device);
> return (1);
>
> #else
> return (1);
> #endif /* HAVE_PPSAPI */
>
> Please, check the code, I just wrote it without reveiwing. :)
Thanks, I will try to use it.
My sleep reccovery is progressing so I could be doing something
intelligent tomorrow. ;-)
Kind regards,
Udo
More information about the LinuxPPS
mailing list