From: Juergen Perlinger Date: Wed, 7 Sep 2011 18:08:08 +0000 (+0200) Subject: [Bug 1999] NMEA driver should not send PMOTG once per second X-Git-Tag: NTP_4_2_7P213~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a6cbf35d653a736070f3eb2391a399e5297eed8;p=thirdparty%2Fntp.git [Bug 1999] NMEA driver should not send PMOTG once per second bk: 4e67b308jsx9MhdMLPRF6Bm-3Zc5sA --- diff --git a/ChangeLog b/ChangeLog index dbb4c1782..f933887bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 1999] NMEA does not send PMOTG messages any more. (4.2.7p212) 2011/09/07 Released by Harlan Stenn * [Bug 2003] from 4.2.6p4-RC3: ntpq_read_assoc_peervars() broken. (4.2.7p211) 2011/09/01 Released by Harlan Stenn diff --git a/ntpd/refclock_nmea.c b/ntpd/refclock_nmea.c index 32605b4a9..9c7cb192e 100644 --- a/ntpd/refclock_nmea.c +++ b/ntpd/refclock_nmea.c @@ -22,6 +22,8 @@ #if defined(REFCLOCK) && defined(CLOCK_NMEA) +#define NMEA_WRITE_SUPPORT 0 /* no write support at the moment */ + #include #include #include @@ -39,12 +41,6 @@ # include "refclock_atom.h" #endif /* HAVE_PPSAPI */ -#ifdef SYS_WINNT -#undef write /* ports/winnt/include/config.h: #define write _write */ -extern int async_write(int, const void *, unsigned int); -#define write(fd, data, octets) async_write(fd, data, octets) -#endif - #define MSYSLOG(args) do { NLOG(NLOG_CLOCKINFO) msyslog args; } while (0) @@ -280,7 +276,6 @@ static void nmea_control (int, const struct refclockstat *, #define NMEA_CONTROL noentry #endif /* HAVE_PPSAPI */ static void nmea_timer (int, struct peer *); -static void gps_send (int, const char *, struct peer *); /* parsing helpers */ static int field_init (nmea_data * data, char * cp, int len); @@ -302,6 +297,21 @@ static int gpsfix_century (struct calendar * jd, const gps_weektm * wd, static int nmead_open (const char * device); +/* + * If we want the friver to ouput sentences, too: re-enable the send + * support functions by defining NMEA_WRITE_SUPPORT to non-zero... + */ +#if NMEA_WRITE_SUPPORT + +static void gps_send(int, const char *, struct peer *); +# ifdef SYS_WINNT +# undef write /* ports/winnt/include/config.h: #define write _write */ +extern int async_write(int, const void *, unsigned int); +# define write(fd, data, octets) async_write(fd, data, octets) +# endif /* SYS_WINNT */ + +#endif /* NMEA_WRITE_SUPPORT */ + /* * ------------------------------------------------------------------- * Transfer vector @@ -550,12 +560,20 @@ nmea_timer( struct peer * peer ) { +#if NMEA_WRITE_SUPPORT + struct refclockproc * const pp = peer->procptr; UNUSED_ARG(unit); if (-1 != pp->io.fd) /* any mode bits to evaluate here? */ gps_send(pp->io.fd, "$PMOTG,RMC,0000*1D\r\n", peer); +#else + + UNUSED_ARG(unit); + UNUSED_ARG(peer); + +#endif /* NMEA_WRITE_SUPPORT */ } #ifdef HAVE_PPSAPI @@ -1029,6 +1047,7 @@ nmea_poll( } } +#if NMEA_WRITE_SUPPORT /* * ------------------------------------------------------------------- * gps_send(fd, cmd, peer) Sends a command to the GPS receiver. @@ -1086,6 +1105,7 @@ gps_send( if (write(fd, cmd, len) == -1) refclock_report(peer, CEVNT_FAULT); } +#endif /* NMEA_WRITE_SUPPORT */ /* * -------------------------------------------------------------------