Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-22 Thread Etaoin Shrdlu


On Tue, 2017-08-22 at 08:50 -0400, Charles Elliott wrote:
> For one thing, 10110 may be the wrong port number to use: "The
> registered ports are those from 1024 through 49151. IANA maintains
> the official list of well-known and registered ranges.[3] The dynamic
> or private ports are those from 49152 through 65535. One common use
> for this range is for ephemeral ports."
> (https://en.wikipedia.org/wiki/Port_(computer_networking))  Second,
> port 10110 may be reserved for NMEA-0183 Navigational Data (on GPS
> devices).  See https://www.iana.org/assignments/service-names-port-
> numbers/service-names-port-numbers.xhtml?
>  names-port-numbers.xhtml?&page=117> &page=117.  You might want to
> consider a port number in [49152, 65535] on 192.168.13.100, if that
> is your computer’s IP address.  I am referring to these error
> messages:
> 

Fine, but it does work - how else would gpsmon be able to show all the
data? Did you see my initial message? I have already confirmed long ago
that gpsd has no trouble receiving and parsing the incoming UDP. The
problem is getting the data from gpsd to ntpd. 


> I agree with the person who wrote that he had never heard of
> accessing a GPS device with UDP; NTPD is not set up for that,
> although using shared memory may be a good workaround.  I am not so
> sure of the PPS signal coming in that way though.  NTPD is set to
> detect PPS from the rising or falling edge of a single RS-232 port
> pin, DCD if I recall correctly.
> 
>  
> 
> Charles Elliott
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-22 Thread Etaoin Shrdlu
On Mon, 2017-08-21 at 10:06 +0200, juergen perlinger wrote:
> On 08/16/2017 02:52 PM, Etaoin Shrdlu wrote:
> > 
> > Hi all, 
> > 
> > I've been battling for some time with getting ntpd to set the
> > date/time
> > from gpsd's shared memory locations. My GPS device is on the
> > network
> > and sends GPS messages every minute over UDP. This is picked up by
> > gpsd
> > and it appears I get a good fix with all the required data. It also
> > looks as if the shared memory locations are being set up correctly.
> > But
> > whatever I do, ntpd time source "reach" stubbornly remains at zero,
> > even when running ntpd as root. I would be most grateful if someone
> > could cast their eyes on the configurations and log output below,
> > and
> > let me know if you can see were it's going wrong! 
> I didn't look to close, but there's an alternative using driver 46
> and
> the JSON API of GPSD. It's a bit easier to set up.

Thanks, tried that, but all I get is "No association ID's returned".
I've put the following in ntp.conf: 

server 127.127.46.0
fudge 127.127.46.0 time1 0.0 time2 0.0 refid GPS

If I start gpsmon I can see the JSON output at the top, and if I curl
localhost:2947 I get it too. As in my previous post, gpsmon reports
valid fix etc. Not sure what to try next, might have to build my own
function to scrape the time/date and set it with "date -s", though this
does seem a little ridiculous. 

> > 
> > 
> > P.S. This has been cross-posted from gpsd-us...@nongnu.org, where I
> > failed to get any response to my query. 
> > 
> > 
> > # syslog gpsd startup: 
> > 
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: launching (Version
> > 3.11)
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: listening on port
> > gpsd
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(0,0,0)
> > succeeded, segment 0
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD
> > shmat(32769,0,0) succeeded, segment 1
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD
> > shmat(65538,0,0) succeeded, segment 2
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD
> > shmat(98307,0,0) succeeded, segment 3
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: successfully
> > connected to the DBUS system bus
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shmat() succeeded,
> > segment 131076
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shared-segment
> > creation succeeded,
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: stashing device
> > udp://192.168.13.100:10110 at slot 0
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: opening UDP feed at
> > 192.168.13.100, port 10110.
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: UDP device open
> > error can't connect to host/port pair.
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: initial GPS device
> > udp://192.168.13.100:10110 open failed
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with
> > effective group ID 20
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with
> > effective user ID 110
> > Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: startup at 2017-08-
> > 06T19:28:16.000Z (1502047696)
> > 
> > # syslog ntpd startup:
> > 
> > Aug  6 19:28:24 computer ntpd[609]: ntpd 4.2.6p5@1.2349-o Mon Jul
> > 25 22:35:28 UTC 2016 (1)
> > Aug  6 19:28:24 computer ntp[582]: Starting NTP server: ntpd.
> > Aug  6 19:28:24 computer ntpd[652]: proto: precision = 0.781 usec
> > Aug  6 19:28:24 computer ntpd[652]: Listen and drop on 0 v4wildcard
> > 0.0.0.0 UDP 123
> > Aug  6 19:28:24 computer systemd[1]: Started LSB: Start NTP daemon.
> > Aug  6 19:28:25 computer ntpd[652]: Listen and drop on 1 v6wildcard
> > :: UDP 123
> > Aug  6 19:28:25 computer ntpd[652]: Listen normally on 2 lo
> > 127.0.0.1 UDP 123
> > Aug  6 19:28:25 computer ntpd[652]: Listen normally on 3 eth0
> > 192.168.13.100 UDP 123
> > Aug  6 19:28:25 computer ntpd[652]: Listen normally on 4 lo ::1 UDP
> > 123
> > Aug  6 19:28:25 computer ntpd[652]: Listen normally on 5 eth0
> > fe80::6a89:f1d3:7ec0:510 UDP 123
> > Aug  6 19:28:25 computer ntpd[652]: peers refreshed
> > Aug  6 19:28:25 computer ntpd[652]: Listening on routing socket on
> > fd #22 for interface updates
> > 
> > # syslog gpsd sample: 
> > 
> > Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS:
> > $GPGGA,185748.0,1234.567890,N,00012.345678,E,1,10,0.9,13.6,M,47.0,M
> > ,,*6B
> > Aug  6 19:56:42 computer gp

Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-22 Thread Etaoin Shrdlu
In case it's any help, here's the full output when running gpsd from
the command line: 

# gpsd -N -D5 udp://192.168.13.100:10110
gpsd:INFO: launching (Version 3.11)
gpsd:IO: opening IPv4 socket
gpsd:IO: opening IPv6 socket
gpsd:INFO: listening on port gpsd
gpsd:PROG: NTPD shmat(0,0,0) succeeded, segment 0
gpsd:PROG: NTPD shmat(32769,0,0) succeeded, segment 1
gpsd:PROG: NTPD shmat(65538,0,0) succeeded, segment 2
gpsd:PROG: NTPD shmat(98307,0,0) succeeded, segment 3
gpsd:PROG: successfully connected to the DBUS system bus
gpsd:PROG: shmat() succeeded, segment 131076
gpsd:PROG: shared-segment creation succeeded,
gpsd:INFO: stashing device N at slot 0
gpsd:INFO: stashing device udp://192.168.13.100:10110 at slot 1
gpsd:INFO: running with effective group ID 20
gpsd:INFO: running with effective user ID 110
gpsd:INFO: startup at 2017-08-18T11:36:44.000Z (1503056204)
gpsd:CLIENT: => client(0): 
{"class":"VERSION","release":"3.11","rev":"3.11-3","proto_major":3,"proto_minor":9}\x0d\x0a
gpsd:PROG: checking client(0)
gpsd:CLIENT: <= client(0): ?WATCH={"raw":2,"pps":true}\x0d\x0a
gpsd:INFO: opening read-only GPS data source type 0 and at 'N'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: N: device activation failed.
gpsd:INFO: opening UDP feed at 192.168.13.100, port 10110.
gpsd:INFO: gpsd_activate(2): activated GPS (fd 7)
gpsd:CLIENT: => client(0): 
{"class":"DEVICES","devices":[{"class":"DEVICE","path":"N"},{"class":"DEVICE","path":"udp://192.168.13.100:10110","activated":"2017-08-18T11:39:01.060Z"}]}\x0d\x0a{"class":"WATCH","enable":true,"json":false,"nmea":false,"raw":2,"scaled":false,"timing":false,"split24":false,"pps":true}\x0d\x0a
gpsd:INFO: reconnection attempt on device 0
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running ACTIVATE hook
gpsd:INFO: opening read-only GPS data source type 0 and at 'N'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: N: device activation failed.
gpsd:PROG: switching to match packet type 1: 
$GPGGA,113947.0,1234.567890,N,00012.34567,E,1,10,0.7,22.3,M,47.0,M,,*62\x0d\x0a
gpsd:PROG: switch_driver(NMEA0183) called...
gpsd:PROG: selecting NMEA0183 driver...
gpsd:INFO: udp://192.168.13.100:10110 identified as type NMEA0183, 35.861665 
sec @ 0bps
gpsd:PROG: => Probing for Garmin NMEA
gpsd:IO: => GPS: $PGRMCE*0E\x0d\x0a FAILED
gpsd:IO: <= GPS: 
$GPGGA,113947.0,1234.567890,N,00012.34567,E,1,10,0.7,22.3,M,47.0,M,,*62
gpsd:WARN: can't use GGA time until after ZDA or RMC has supplied a year.
gpsd:PROG: GPGGA sentence timestamped 113947.00.
gpsd:PROG: GPGGA starts a reporting cycle.
gpsd:PROG: device 1 (fd=7, path udp://192.168.13.100:10110) already active.
gpsd:CLIENT: => client(0): 
$GPGGA,113947.0,1234.567890,N,00012.34567,E,1,10,0.7,22.3,M,47.0,M,,*62\x0d\x0a
gpsd:PROG: Changed mask: 
{ONLINE|LATLON|ALTITUDE|STATUS|MODE|PACKET|DRIVER|CLEAR|REPORT} with unreliable 
cycle detection
gpsd:PROG: time to report a fix
gpsd:PROG: => Probing for SiRF
gpsd:IO: => GPS: $PSRF100,0,0,9,0,0*33\x0d\x0a FAILED
gpsd:IO: <= GPS: 
$GPRMC,113947.0,A,1234.567890,N,00012.34567,E,0.0,122.4,180817,0.0,E,A*0F
gpsd:PROG: GPRMC sentence timestamped 113947.00.
gpsd:CLIENT: => client(0): 
$GPRMC,113947.0,A,1234.567890,N,00012.34567,E,0.0,122.4,180817,0.0,E,A*0F\x0d\x0a
gpsd:PROG: Changed mask: {ONLINE|TIME|LATLON|SPEED|TRACK|PACKET|REPORT|PPSTIME} 
with unreliable cycle detection
gpsd:PROG: time to report a fix
gpsd:PROG: => Probing for FV-18
gpsd:IO: => GPS: $PFEC,GPint*58\x0d\x0a FAILED
gpsd:IO: <= GPS: $GPVTG,122.4,T,122.4,M,0.0,N,0.0,K,A*23
gpsd:CLIENT: => client(0): $GPVTG,122.4,T,122.4,M,0.0,N,0.0,K,A*23\x0d\x0a
gpsd:PROG: => Probing for Trimble Copernicus
gpsd:IO: => GPS: $PTNLSNM,0139,01*5C\x0d\x0a FAILED
gpsd:IO: <= GPS: $GPGSA,A,2,07,08,10,15,16,18,20,21,26,27,,,1.0,0.7,0.7*36
gpsd:PROG: GPGSA sets mode 2
gpsd:CLIENT: => client(0): 
$GPGSA,A,2,07,08,10,15,16,18,20,21,26,27,,,1.0,0.7,0.7*36\x0d\x0a
gpsd:PROG: Changed mask: {ONLINE|DOP|PACKET|USED} with unreliable cycle 
detection
gpsd:INFO: reconnection attempt on device 0
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running ACTIVATE hook
gpsd:INFO: opening read-only GPS data source type 0 and at 'N'
gpsd:ERROR: device open failed: Permission denied - retrying read-only
gpsd:ERROR: read-only device open failed: Permission denied
gpsd:ERROR: N: device activation failed.
gpsd:PROG: => Probing for Evermore
gpsd:IO: => GPS: 1002128e7f010100010101131003 FAILED
gpsd:IO: <= GPS: $GNGSA,A,2,07,08,10,15,16,18,20,21,26,27,,,1.0,0.7,0.7*28
gpsd:PROG: GPGSA sets mode 2
gpsd:CLIENT: => client(0): 
$GNGSA,A,2,07,08,10,15,16,18,20,21,26,27,,,1.0,0.7,0.7*28\x0d\x0a
gpsd:PROG: Changed mask: {ONLINE|DOP|PACKET|USED} with unreliable cycle 
detection
gpsd:PROG: => Probing for GPSClock
gpsd:IO: => GPS: $PFEC,GPsrq*5B\x0d\x0a FAILED
gpsd:IO: <= GPS: $GNGSA,A,

Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-22 Thread Etaoin Shrdlu
On Fri, 2017-08-18 at 12:46 +0100, Etaoin Shrdlu wrote:
> In case it's any help, here's the full output when running gpsd from
> the command line: 

Whoops, typo there - forget about device "N" (0), this is all about the
second (1, UDP) device. 
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-22 Thread Etaoin Shrdlu
Hi guys, 

Thanks a million for getting back to me on this, really appreaciate it!

On Wed, 2017-08-16 at 13:40 -0700, Gary E. Miller wrote:
> Yo Etaoin!
> 
> On Wed, 16 Aug 2017 13:52:44 +0100
> Etaoin Shrdlu  wrote:
> 
> > 
> > P.S. This has been cross-posted from gpsd-us...@nongnu.org, where I
> > failed to get any response to my query. 
> I never saw it there.  I just sent a test message to that list and
> the
> list is working fine.

Odd, it's in the list archive: http://lists.nongnu.org/archive/html/gps
d-users/2017-08/msg2.html 

> It looks like the time is not getting from gpsd to ntpd.  The test
> that shows the link between gpsd and ntp over shm is ntpshmmon, part
> of the gpsd pacakge.. Just run that and see what you get:
> 
> It should look like this:
> 
> # ntpshmmon
> ntpshmmon version 1
> #  Name
> Seen@ClockReal L Prec
> sample NTP0 1502915839.595703946 1502915839.583110543
> 1502915839.70396 0 -20
> sample NTP1 1502915840.40002 1502915840.14822
> 1502915840.0 0 -30
> sample NTP0 1502915840.603454013 1502915840.603269997
> 1502915840.70396 0 -20
> sample NTP1 1502915841.99871 1502915840.82405
> 1502915841.0 0 -30

On Thu, 2017-08-17 at 07:11 +0200, Miroslav Lichvar wrote:
> There is a ntpshmmon program included with gpsd, which should show
> you if gpsd is actually writing to the SHM segments and whether it's
> a problem on the gpsd or ntpd side. However, I'm not sure if this is
> supposed to work with GPS over network.

I had to build the gpsd clients manually since this is a headless
system, and the package in the repo depends on X (due to it including
some Gnome apps), but I got them now and you're right ntpshmmon returns
nothing: 

/gpsd-3.16# ./ntpshmmon
ntpshmmon version 1
#  Name   Seen@ClockReal   L 
Prec

> Also, how are you starting gpsd and ntpd?
> I do not know anyone using GPS over udp...

I tested starting gpsd manually in a root terminal with 

# gpsd -N udp://192.168.13.100:10110

But it makes no difference. gpsmon still works though, so I don't think there's 
an issue with gpsd getting its data via UDP. More likely to have something to 
do with shm permissions, but I've never dealt with this before so I'm a little 
lost... 

Thanks, 

Etaoin
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


[ntp:questions] How to get shared memory access from gpsd to ntpd to work?

2017-08-16 Thread Etaoin Shrdlu
Hi all, 

I've been battling for some time with getting ntpd to set the date/time
from gpsd's shared memory locations. My GPS device is on the network
and sends GPS messages every minute over UDP. This is picked up by gpsd
and it appears I get a good fix with all the required data. It also
looks as if the shared memory locations are being set up correctly. But
whatever I do, ntpd time source "reach" stubbornly remains at zero,
even when running ntpd as root. I would be most grateful if someone
could cast their eyes on the configurations and log output below, and
let me know if you can see were it's going wrong! 

P.S. This has been cross-posted from gpsd-us...@nongnu.org, where I
failed to get any response to my query. 


# syslog gpsd startup: 

Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: launching (Version 3.11)
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: listening on port gpsd
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(0,0,0) succeeded, 
segment 0
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(32769,0,0) succeeded, 
segment 1
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(65538,0,0) succeeded, 
segment 2
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: NTPD shmat(98307,0,0) succeeded, 
segment 3
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: successfully connected to the 
DBUS system bus
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shmat() succeeded, segment 131076
Aug  6 19:28:16 computer gpsd[374]: gpsd:PROG: shared-segment creation 
succeeded,
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: stashing device 
udp://192.168.13.100:10110 at slot 0
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: opening UDP feed at 
192.168.13.100, port 10110.
Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: UDP device open error can't 
connect to host/port pair.
Aug  6 19:28:16 computer gpsd[374]: gpsd:ERROR: initial GPS device 
udp://192.168.13.100:10110 open failed
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with effective group ID 
20
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: running with effective user ID 
110
Aug  6 19:28:16 computer gpsd[374]: gpsd:INFO: startup at 
2017-08-06T19:28:16.000Z (1502047696)

# syslog ntpd startup:

Aug  6 19:28:24 computer ntpd[609]: ntpd 4.2.6p5@1.2349-o Mon Jul 25 22:35:28 
UTC 2016 (1)
Aug  6 19:28:24 computer ntp[582]: Starting NTP server: ntpd.
Aug  6 19:28:24 computer ntpd[652]: proto: precision = 0.781 usec
Aug  6 19:28:24 computer ntpd[652]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 
123
Aug  6 19:28:24 computer systemd[1]: Started LSB: Start NTP daemon.
Aug  6 19:28:25 computer ntpd[652]: Listen and drop on 1 v6wildcard :: UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 2 lo 127.0.0.1 UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 3 eth0 192.168.13.100 
UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 4 lo ::1 UDP 123
Aug  6 19:28:25 computer ntpd[652]: Listen normally on 5 eth0 
fe80::6a89:f1d3:7ec0:510 UDP 123
Aug  6 19:28:25 computer ntpd[652]: peers refreshed
Aug  6 19:28:25 computer ntpd[652]: Listening on routing socket on fd #22 for 
interface updates

# syslog gpsd sample: 

Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGGA,185748.0,1234.567890,N,00012.345678,E,1,10,0.9,13.6,M,47.0,M,,*6B
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGGA sentence timestamped 
185748.00.
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGGA starts a reporting cycle.
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPRMC,185748.0,A,1234.567890,N,00012.345678,E,0.0,,060817,0.0,E,A*2B
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPRMC sentence timestamped 
185748.00.
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPRMC ends a reporting cycle.
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPVTG,,T,0.0,M,0.0,N,0.0,K,A*0D
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSA,A,2,01,03,06,09,11,17,19,22,23,31,,,1.2,0.9,0.8*31
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: GPGSA sets mode 2
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,1,13,01,31,136,41,03,67,068,35,06,32,303,31,09,34,202,41*78
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (1 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,2,13,11,09,153,39,17,40,243,40,19,42,272,30,22,42,082,40*78
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (2 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: 
$GPGSV,4,3,13,23,61,174,46,31,19,047,36,12,04,329,,14,00,039,*76
Aug  6 19:56:42 computer gpsd[374]: gpsd:PROG: Partial satellite data (3 of 4).
Aug  6 19:56:42 computer gpsd[374]: gpsd:IO: <= GPS: $GPGSV,4,4,13,25,01,001,*4C


# /etc/default/gpsd

START_DAEMON="true"
USBAUTO="false"
DEVICES="udp://192.168.13.100:10110"
GPSD_OPTIONS="-n -D5"


# ntpd.conf: 

GPS Serial data reference (NTP0)
server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 time1 0.0 refid GPS

GPS PPS reference (NTP1)
server 127.127.28.1