[ntpsec commit] Droppe support for Forum Graphic GPS Dating station refclock (type 37)...
Eric S. Raymond
esr at ntpsec.org
Sun Oct 4 14:54:13 UTC 2015
Module: ntpsec
Branch: master
Commit: 4dfa850a5270b957a30167024034635e542aaec0
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=4dfa850a5270b957a30167024034635e542aaec0
Author: Eric S. Raymond <esr at thyrsus.com>
Date: Sun Oct 4 10:52:26 2015 -0400
Droppe support for Forum Graphic GPS Dating station refclock (type 37)...
...due to Y2K issues.
---
docs/driver37.txt | 64 ----------
docs/refclock.txt | 3 +-
libntp/clocktypes.c | 4 +-
ntpd/refclock_conf.c | 8 +-
ntpd/refclock_fg.c | 327 ---------------------------------------------------
pylib/refclock.py | 6 -
6 files changed, 4 insertions(+), 408 deletions(-)
diff --git a/docs/driver37.txt b/docs/driver37.txt
deleted file mode 100644
index 6263de1..0000000
--- a/docs/driver37.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-= Forum Graphic GPS Dating station =
-
-== Synopsis ==
-
-["verse",subs="normal"]
-Address: 127.127.37.'u'
-Reference ID: GPS
-Driver ID: GPS
-Parallel Port: `/dev/fgclock`__u__
-
-== Deprecation warning ==
-
-This refclock is deprecated and obsolete. The {project-shortname}
-maintainers plan to remove it in a future release. If you have a
-requirement for it, please make this known to us.
-
-== Description ==
-
-This driver supports the Forum Graphic GPS Dating station sold by
-http://www.emr.fr/gpsclock.html[EMR company].
-
-Unfortunately sometime FG GPS start continues reporting of the same
-date. The only way to fix this problem is GPS power cycling and ntpd
-restart after GPS power-up.
-
-After Jan 10, 2000 my FG GPS unit start send a wrong answer after 10:00am
-till 11:00am. It repeat hour value in result string twice. I wroite a
-small code to avoid such problem. Unfortunately I have no second FG GPS
-unit to evaluate this problem. Please let me know if your GPS has no
-problems after Y2K.
-
-== Monitor Data ==
-
-Each timecode is written to the `clockstats` file in the format
-`YYYY YD HH MI SS`.
-
-== Fudge Factors ==
-
-`tiime1` 'time'::
- Specifies the time offset calibration factor, in seconds and
- fraction, with default 0.0.
-`time2` 'time'::
- Not used by this driver.
-`stratum` 'number'::
- Specifies the driver stratum, in decimal from 0 to 15, with default 0.
-`refid` 'string'::
- Specifies the driver reference identifier, an ASCII string from one to
- four characters, with default `FG`.
-`flag1 0 | 1`::
- Not used by this driver.
-`flag2 0 | 1`::
- Not used by this driver.
-`flag3 0 | 1`::
- Not used by this driver.
-`flag4 0 | 1`::
- Not used by this driver.
-
-== Author ==
-
-Dmitry Smirnov <das at amt.ru>
-
-'''''
-
-include::includes/footer.txt[]
diff --git a/docs/refclock.txt b/docs/refclock.txt
index aefbafd..ec1e19e 100644
--- a/docs/refclock.txt
+++ b/docs/refclock.txt
@@ -170,7 +170,6 @@ Datum/Bancomm/Symmetricom bc600-series GPS/IRIG Receiver.
| link:driver31.html[Type 31] | D | Rockwell Jupiter GPS
| link:driver33.html[Type 33] | D | Dumb Clock
| link:driver35.html[Type 35] | D | Conrad Parallel Port Radio Clock
-| link:driver37.html[Type 37] | D | Forum Graphic GPS Dating station
| link:driver38.html[Type 38] | D | hopf GPS/DCF77 6021/komp for Serial Line
| link:driver39.html[Type 39] | - | hopf GPS/DCF77 6039 for PCI-Bus
| link:driver40.html[Type 40] | T | JJY Receivers
@@ -188,7 +187,7 @@ The flags field should be interpreted as follows:
|====================================================================
Driver numbers 2, 3, 12, 13, 14, 15, 16, 17, 19, 21, 23, 24, 25, 32, 34,
-36, 41, and 43 (all unused numbers below 46) are reserved. Some of
+36, 37, 41, and 43 (all unused numbers below 46) are reserved. Some of
these were used by refclock types (now obsolete) in older NTP versions
diff --git a/libntp/clocktypes.c b/libntp/clocktypes.c
index b994f4d..e420fe1 100644
--- a/libntp/clocktypes.c
+++ b/libntp/clocktypes.c
@@ -82,8 +82,8 @@ struct clktype clktypes[] = {
"PCF"},
{ REFCLK_NONE, "not used (36)",
"NOT_USED" },
- { REFCLK_FG, "Forum Graphic GPS Dating Station (37)",
- "GPS_FG"},
+ { REFCLK_NONE, "not used (37)",
+ "NOT_USED" },
{ REFCLK_HOPF_SERIAL, "hopf Elektronic serial line receiver (38)",
"HOPF_S"},
{ REFCLK_HOPF_PCI, "hopf Elektronic PCI receiver (39)",
diff --git a/ntpd/refclock_conf.c b/ntpd/refclock_conf.c
index 26458cb..92a017b 100644
--- a/ntpd/refclock_conf.c
+++ b/ntpd/refclock_conf.c
@@ -134,12 +134,6 @@ extern struct refclock refclock_pcf;
#define refclock_pcf refclock_none
#endif
-#ifdef CLOCK_FG
-extern struct refclock refclock_fg;
-#else
-#define refclock_fg refclock_none
-#endif
-
#ifdef CLOCK_HOPF_SERIAL
extern struct refclock refclock_hopfser;
#else
@@ -225,7 +219,7 @@ struct refclock * const refclock_conf[] = {
&refclock_none, /* 34 was: REFCLOCK_ULINK */
&refclock_pcf, /* 35 REFCLOCK_PCF */
&refclock_none, /* 36 was: REFCLOCK_WWV_AUDIO */
- &refclock_fg, /* 37 REFCLOCK_FG */
+ &refclock_none, /* 37 was: REFCLOCK_FG */
&refclock_hopfser, /* 38 REFCLK_HOPF_SERIAL */
&refclock_hopfpci, /* 39 REFCLK_HOPF_PCI */
&refclock_jjy, /* 40 REFCLK_JJY */
diff --git a/ntpd/refclock_fg.c b/ntpd/refclock_fg.c
deleted file mode 100644
index aa0d563..0000000
--- a/ntpd/refclock_fg.c
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * refclock_fg - clock driver for the Forum Graphic GPS datating station
- */
-
-#include <config.h>
-#include "ntpd.h"
-#include "ntp_io.h"
-#include "ntp_refclock.h"
-#include "ntp_calendar.h"
-#include "ntp_stdlib.h"
-
-/*
- * This driver supports the Forum Graphic GPS dating station.
- * More information about FG GPS is available on http://www.forumgraphic.com
- * Contact das at amt.ru for any question about this driver.
- */
-
-/*
- * Interface definitions
- */
-#define DEVICE "/dev/fgclock%d"
-#define PRECISION (-10) /* precision assumed (about 1 ms) */
-#define REFID "GPS"
-#define DESCRIPTION "Forum Graphic GPS dating station"
-#define LENFG 26 /* timecode length */
-#define SPEED232 B9600 /* uart speed (9600 baud) */
-
-/*
- * Function prototypes
- */
-static bool fg_init (int);
-static bool fg_start (int, struct peer *);
-static void fg_shutdown (int, struct peer *);
-static void fg_poll (int, struct peer *);
-static void fg_receive (struct recvbuf *);
-
-/*
- * Forum Graphic unit control structure
- */
-
-struct fgunit {
- int pollnum; /* Use peer.poll instead? */
- int status; /* Hug to check status information on GPS */
- int y2kwarn; /* Y2K bug */
-};
-
-/*
- * Queries definition
- */
-static char fginit[] = { 0x10, 0x48, 0x10, 0x0D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0 };
-static char fgdate[] = { 0x10, 0x44, 0x10, 0x0D, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
-/*
- * Transfer vector
- */
-struct refclock refclock_fg = {
- fg_start, /* start up driver */
- fg_shutdown, /* shut down driver */
- fg_poll, /* transmit poll message */
- noentry, /* not used */
- noentry, /* initialize driver (not used) */
- noentry, /* not used */
- noentry /* not used */
-};
-
-/*
- * fg_init - Initialization of FG GPS.
- */
-
-static bool
-fg_init(
- int fd
- )
-{
- if (write(fd, fginit, LENFG) != LENFG)
- return false;
-
- return true;
-}
-
-/*
- * fg_start - open the device and initialize data for processing
- */
-static bool
-fg_start(
- int unit,
- struct peer *peer
- )
-{
- struct refclockproc *pp;
- struct fgunit *up;
- int fd;
- char device[20];
-
-
- /*
- * Open device file for reading.
- */
- snprintf(device, sizeof(device), DEVICE, unit);
-
- DPRINTF(1, ("starting FG with device %s\n",device));
-
- fd = refclock_open(device, SPEED232, LDISC_CLK);
- if (fd <= 0)
- /* coverity[leaked_handle] */
- return false;
-
- /*
- * Allocate and initialize unit structure
- */
-
- up = emalloc(sizeof(struct fgunit));
- memset(up, 0, sizeof(struct fgunit));
- pp = peer->procptr;
- pp->unitptr = up;
- pp->io.clock_recv = fg_receive;
- pp->io.srcclock = peer;
- pp->io.datalen = 0;
- pp->io.fd = fd;
- if (!io_addclock(&pp->io)) {
- close(fd);
- pp->io.fd = -1;
- return false;
- }
-
-
- /*
- * Initialize miscellaneous variables
- */
- peer->precision = PRECISION;
- pp->clockdesc = DESCRIPTION;
- memcpy(&pp->refid, REFID, 3);
- up->pollnum = 0;
-
- /*
- * Setup dating station to use GPS receiver.
- * GPS receiver should work before this operation.
- */
- if(!fg_init(pp->io.fd))
- refclock_report(peer, CEVNT_FAULT);
-
- return true;
-}
-
-
-/*
- * fg_shutdown - shut down the clock
- */
-static void
-fg_shutdown(
- int unit,
- struct peer *peer
- )
-{
- struct refclockproc *pp;
- struct fgunit *up;
-
- pp = peer->procptr;
- up = pp->unitptr;
- if (pp->io.fd != -1)
- io_closeclock(&pp->io);
- if (up != NULL)
- free(up);
-}
-
-
-/*
- * fg_poll - called by the transmit procedure
- */
-static void
-fg_poll(
- int unit,
- struct peer *peer
- )
-{
- struct refclockproc *pp;
-
- pp = peer->procptr;
-
- /*
- * Time to poll the clock. The FG clock responds to a
- * "<DLE>D<DLE><CR>" by returning a timecode in the format specified
- * above. If nothing is heard from the clock for two polls,
- * declare a timeout and keep going.
- */
-
- if (write(pp->io.fd, fgdate, LENFG) != LENFG)
- refclock_report(peer, CEVNT_FAULT);
- else
- pp->polls++;
-
- /*
- if (pp->coderecv == pp->codeproc) {
- refclock_report(peer, CEVNT_TIMEOUT);
- return;
- }
- */
-
- record_clock_stats(&peer->srcadr, pp->a_lastcode);
-
- return;
-
-}
-
-/*
- * fg_receive - receive data from the serial interface
- */
-static void
-fg_receive(
- struct recvbuf *rbufp
- )
-{
- struct refclockproc *pp;
- struct fgunit *up;
- struct peer *peer;
- char *bpt;
-
- /*
- * Initialize pointers and read the timecode and timestamp
- * We can't use gtlin function because we need bynary data in buf */
-
- peer = rbufp->recv_peer;
- pp = peer->procptr;
- up = pp->unitptr;
-
- /*
- * Below hug to implement receiving of status information
- */
- if(!up->pollnum) {
- up->pollnum++;
- return;
- }
-
-
- if (rbufp->recv_length < (LENFG - 2)) {
- refclock_report(peer, CEVNT_BADREPLY);
- return; /* The reply is invalid discard it. */
- }
-
- /* Below I trying to find a correct reply in buffer.
- * Sometime GPS reply located in the beginnig of buffer,
- * sometime you can find it with some offset.
- */
-
- bpt = (char *)rbufp->recv_space.X_recv_buffer;
- while (*bpt != '\x10')
- bpt++;
-
-#define BP2(x) ( bpt[x] & 15 )
-#define BP1(x) (( bpt[x] & 240 ) >> 4)
-
- pp->year = BP1(2) * 10 + BP2(2);
-
- if (pp->year == 94) {
- refclock_report(peer, CEVNT_BADREPLY);
- if (!fg_init(pp->io.fd))
- refclock_report(peer, CEVNT_FAULT);
- return;
- /* GPS is just powered up. The date is invalid -
- discarding it. Initilize GPS one more time */
- /* Sorry - this driver will broken in 2094 ;) */
- }
-
- if (pp->year < 99)
- pp->year += 100;
-
- pp->year += 1900;
- pp->day = 100 * BP2(3) + 10 * BP1(4) + BP2(4);
-
-/*
- After Jan, 10 2000 Forum Graphic GPS receiver had a very strange
- benahour. It doubles day number for an hours in replys after 10:10:10 UTC
- and doubles min every hour at HH:10:ss for a minute.
- Hope it is a problem of my unit only and not a Y2K problem of FG GPS.
- Below small code to avoid such situation.
-*/
- if (up->y2kwarn > 10)
- pp->hour = BP1(6)*10 + BP2(6);
- else
- pp->hour = BP1(5)*10 + BP2(5);
-
- if ((up->y2kwarn > 10) && (pp->hour == 10)) {
- pp->minute = BP1(7)*10 + BP2(7);
- pp->second = BP1(8)*10 + BP2(8);
- pp->nsec = (BP1(9)*10 + BP2(9)) * 1000000;
- pp->nsec += BP1(10) * 1000;
- } else {
- pp->hour = BP1(5)*10 + BP2(5);
- pp->minute = BP1(6)*10 + BP2(6);
- pp->second = BP1(7)*10 + BP2(7);
- pp->nsec = (BP1(8)*10 + BP2(8)) * 1000000;
- pp->nsec += BP1(9) * 1000;
- }
-
- if ((pp->hour == 10) && (pp->minute == 10)) {
- up->y2kwarn++;
- }
-
- snprintf(pp->a_lastcode, sizeof(pp->a_lastcode),
- "%d %d %d %d %d", pp->year, pp->day, pp->hour,
- pp->minute, pp->second);
- pp->lencode = strlen(pp->a_lastcode);
- /*get_systime(&pp->lastrec);*/
-
-#ifdef DEBUG
- if (debug)
- printf("fg: time is %04d/%03d %02d:%02d:%02d UTC\n",
- pp->year, pp->day, pp->hour, pp->minute, pp->second);
-#endif
- pp->disp = (10e-6);
- pp->lastrec = rbufp->recv_time; /* Is it better than get_systime()? */
- /* pp->leap = LEAP_NOWARNING; */
-
- /*
- * Process the new sample in the median filter and determine the
- * timecode timestamp.
- */
-
- if (!refclock_process(pp))
- refclock_report(peer, CEVNT_BADTIME);
- pp->lastref = pp->lastrec;
- refclock_receive(peer);
- return;
-}
-
diff --git a/pylib/refclock.py b/pylib/refclock.py
index 079b09b..28d2ddf 100644
--- a/pylib/refclock.py
+++ b/pylib/refclock.py
@@ -132,12 +132,6 @@ refclock_map = {
"file": "pcf"
},
- 37: {
- "descr": "Forum Graphic GPS Dating station",
- "define": "CLOCK_FG",
- "file": "fg"
- },
-
38: {
"descr": "hopf GPS/DCF77 6021/komp for Serial Line",
"define": "CLOCK_HOPF_SERIAL",
More information about the vc
mailing list