[LinuxPPS] FW: ntp-4.2.4p0 + ntpd_nmea.patch

Rodolfo Giometti giometti at enneenne.com
Mon Aug 20 18:39:38 CEST 2007


On Mon, Aug 20, 2007 at 06:17:53PM +0200, Udo van den Heuvel wrote:

> 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?)

Yes. Just one clock with or without PPS support.

> > 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?)

Function time_pps_create() fails when «fd» points to a non PPS device.

in Linux, since your serial line is _not_ a PPS device, it fails
always and then the refclock needs to open DEVICEPPS, then the
following open() may fail if no links in /dev are present and the
second time_pps_create() may fail if the supplied device in DEVICEPPS
is not a valid PPS device.

> > 		   (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.

Please, note also that you have to manage closing stage accordingly to
this opening stage.

> My sleep reccovery is progressing so I could be doing something
> intelligent tomorrow. ;-)

Eheheheh :)

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



More information about the LinuxPPS mailing list