From: Juergen Perlinger Date: Tue, 4 Jun 2019 05:59:30 +0000 (+0200) Subject: [Bug 3490] Patch to support Trimble Resolution Receivers X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75aca34a37f2902ec16c4fe0e8aa8f1262c52758;p=thirdparty%2Fntp.git [Bug 3490] Patch to support Trimble Resolution Receivers bk: 5cf608c2rHzAjEJf65YBftdLOVYdaw --- diff --git a/ChangeLog b/ChangeLog index 9ff845c81..ed68059a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +--- +* [Bug 3490] Patch to support Trimble Resolution Receivers + - applied (modified) patch by Richard Steedman + --- (4.2.8p13) 2019/03/07 Released by Harlan Stenn diff --git a/ntpd/refclock_palisade.c b/ntpd/refclock_palisade.c index d69ce9400..492c149ad 100644 --- a/ntpd/refclock_palisade.c +++ b/ntpd/refclock_palisade.c @@ -52,6 +52,8 @@ * * * + * 21/04/18: Added support for Resolution devices. + * * 31/03/06: Added support for Thunderbolt GPS Disciplined Clock. * Contact: Fernando Pablo Hauscarriaga * E-mail: fernandoph@iar.unlp.edu.ar @@ -114,6 +116,7 @@ static int decode_date(struct refclockproc *pp, const char *cp); #define CLK_THUNDERBOLT 2 /* Trimble Thunderbolt GPS Receiver */ #define CLK_ACUTIME 3 /* Trimble Acutime Gold */ #define CLK_ACUTIMEB 4 /* Trimble Actutime Gold Port B */ +#define CLK_RESOLUTION 5 /* Trimble Resolution Receivers */ int praecis_msg; static void praecis_parse(struct recvbuf *rbufp, struct peer *peer); @@ -254,6 +257,37 @@ init_acutime ( free(tx.data); } +/* + * init_resolution - Prepares Resolution receiver to be used with NTP + */ +static void +init_resolution ( + int fd + ) +{ + struct packettx tx; + + tx.size = 0; + tx.data = (u_char *) emalloc(100); + + /* set UTC time */ + sendsupercmd (&tx, 0x8E, 0xA2); + sendbyte (&tx, 0x3); + sendetx (&tx, fd); + + /* squelch PPS output unless locked to at least one satellite */ + sendsupercmd (&tx, 0x8E, 0x4E); + sendbyte (&tx, 0x3); + sendetx (&tx, fd); + + /* activate packets 0x8F-AB and 0x8F-AC */ + sendsupercmd (&tx, 0x8E, 0xA5); + sendint (&tx, 0x5); + sendetx (&tx, fd); + + free(tx.data); +} + /* * palisade_start - open the devices and initialize data for processing */ @@ -321,6 +355,11 @@ palisade_start ( msyslog(LOG_NOTICE, "Palisade(%d) Acutime Gold mode enabled" ,unit); break; + case CLK_RESOLUTION: + msyslog(LOG_NOTICE, "Palisade(%d) Resolution mode enabled" + ,unit); + tio.c_cflag = (CS8|CLOCAL|CREAD|PARENB|PARODD); + break; default: msyslog(LOG_NOTICE, "Palisade(%d) mode unknown",unit); break; @@ -371,6 +410,8 @@ palisade_start ( init_thunderbolt(fd); if (up->type == CLK_ACUTIME) init_acutime(fd); + if (up->type == CLK_RESOLUTION) + init_resolution(fd); return 1; } @@ -496,7 +537,10 @@ TSIP_decode ( * proper format, declare bad format and exit. */ - if ((up->type != CLK_THUNDERBOLT) & (up->type != CLK_ACUTIME)){ + if ((up->type != CLK_THUNDERBOLT) && + (up->type != CLK_ACUTIME ) && + (up->type != CLK_RESOLUTION) ) + { if ((up->rpt_buf[0] == (char) 0x41) || (up->rpt_buf[0] == (char) 0x46) || (up->rpt_buf[0] == (char) 0x54) ||