[LinuxPPS] ntp 'bugs'
Rodolfo Giometti
giometti at enneenne.com
Sun Jun 29 13:00:57 CEST 2008
On Sun, Jun 29, 2008 at 12:37:25PM +0200, Udo van den Heuvel wrote:
> --- a/ntpd/refclock_nmea.c 2006-06-06 22:16:53.000000000 +0200
> +++ b/ntpd/refclock_nmea.c 2008-06-29 12:33:09.000000000 +0200
> @@ -61,6 +61,7 @@
> # define DEVICE "COM%d:" /* COM 1 - 3 supported */
> #else
> # define DEVICE "/dev/gps%d" /* name of radio device */
> +# define DEVICEPPS "/dev/gpspps%d" /* name of alternate PPS radio device */
> #endif
> #define SPEED232 B4800 /* uart speed (4800 bps) */
> #define PRECISION (-9) /* precision assumed (about 2 ms) */
> @@ -71,6 +72,7 @@
> #define RANGEGATE 500000 /* range gate (ns) */
>
> #define LENNMEA 75 /* min timecode length */
> +#define LENPPS PPS_MAX_NAME_LEN
This must be removed since is LinuxPPS specific and not used below.
> /*
> * Tables to compute the ddd of year form icky dd/mm timecode. Viva la
> @@ -230,13 +232,36 @@
> * 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) {
> - up->handle = 0;
> - msyslog(LOG_ERR,
> - "refclock_nmea: time_pps_create failed: %m");
> - return (1);
> + msyslog(LOG_ERR, "refclock_nmea: found GPS source \"%s\"", device);
> + if (time_pps_create(pp->io.fd, &up->handle) == 0) {
> + msyslog(LOG_INFO, "refclock_nmea: found PPS source \"%s\"", device);
> + return(nmea_ppsapi(peer, 0, 0)); }
> + else {
> + /* Try the alternate PPS device */
> + (void) sprintf(device, DEVICEPPS, unit);
> + fd = open(device, O_RDWR);
> + if (fd > 0) { /* /dev/gpspps0 exists */
Should be >= 0...
> + msyslog(LOG_ERR, "refclock_nmea: try \"%s\" for PPS", device);
> + if (time_pps_create(fd, &up->handle) == 0) {
> + msyslog(LOG_INFO, "refclock_nmea: found PPS source \"%s\"", device);
> + return(nmea_ppsapi(peer, 0, 0));
> + }
> + else close(fd);
> + }
More information about the LinuxPPS
mailing list