[LinuxPPS] ntp 'bugs'

Udo van den Heuvel udovdh at xs4all.nl
Sun Jun 29 11:44:33 CEST 2008


Rodolfo Giometti wrote:
>> Hmm. I had to look at the code in refclock_nmea...
>> Does the ldisc change work on the pps device so that it effects the
>> `connected` serial line?
>> This because the first time_pps_create in refclock_nmea is on the pps
>> device. Only when that fails we do a time_pps_create on the serial line
>> itself as a fallback.
> 
> But usually you have the serial line as the main PPS device and
> /dev/pps{N} as altrenate one. Is that rigth?
> 
>> Please enlighten us on the flow of the change in time_pps_create and the
>> correlation with e.g. the code in refclock_nmea.
> 
> Here the refclock nmea code:
> 
> +       msyslog(LOG_ERR, "refclock_nmea: found GPS source \"%s\"", device);
> +       if (time_pps_create(pp->io.fd, &up->handle) < 0) {
> +               /* Try the alternate PPS device */
> +                (void) sprintf(device, DEVICEPPS, unit);
> +               msyslog(LOG_ERR, "refclock_nmea: try alternate PPS device \"%s\"", device);
> +                fd = open(device, O_RDWR);
> +                if (fd < 0)
> +                       goto pps_error;
> +               if (time_pps_create(fd, &up->handle) < 0)
> +                               goto pps_error;
>         }
> +       else (void) sprintf(device, DEVICE, unit); /* just rebuild device's name */
> 
> I suppose file descriptor pp->io.fd is related to the serial line so
> in the above time_pps_create() the ioctl(source, PPS_CHECK) fails and
> the ldisc is changed returing error. This causes a an
> open("/dev/pps{N}", ...) and a new time_pps_create() on the PPS
> device.
> 
> Is that right?

Yes and no.
Your rationale is right, but the agreed patch, at this time, from the
bug at https://support.ntp.org/bugs/show_bug.cgi?id=610 is at
https://support.ntp.org/bugs/attachment.cgi?id=405.
There you see that there is *no* time_pps_create for the NMEA carrying
serial line because we expect PPS from the PPS devcie which is tried next.
Of course this can be changed!

Udo






More information about the LinuxPPS mailing list