On Wed, Aug 29, 2018 at 02:13:01PM -0600, Theo de Raadt wrote: > Landry Breuil <[email protected]> wrote: > > > Hi, > > > > was playing with an usb gps that works ootb with gpsd, but our nmea line > > discipline doesnt recognize it, and the 'indicator' sensor stays at its > > default 'unknown'. > > > > The gps is a navilock nl-8002u: > > umodem0 at uhub3 port 2 configuration 1 interface 0 "u-blox AG - > > www.u-blox.com u-blox GNSS receiver" rev 1.10/2.01 addr 2 > > umodem0: data interface 1, has CM over data, has no break > > umodem0: status change notification available > > ucom1 at umodem0 > > > > The RMC message our tty_nmea.c code looks for is like this w/ this device: > > $GNRMC,194858.00,A,xxxxxxxx,N,yyyyyyy,E,0.236,,290818,,,A*6E > > > > Turns out the NMEA 0183 spec says that RMC message types are prefixed by > > various > > codes for 'talkers' which says if the data comes from GPS (GP), Glonass > > (GL), > > Galileo (GA), Beidou (BD), or 'Global navigation satellite' (GN) for the > > 'generic term' (cf http://freenmea.net/docs or > > https://github.com/mvglasow/satstat/wiki/NMEA-IDs) and mine uses GNRMC, > > while > > tty_nmea.c looks for GPRMC. > > > > Poking at the string comparison, i finally have sensors working: > > > > $doas ldattach -d nmea /dev/cuaU1 > > ldattach[93876]: attach nmea on /dev/cuaU1 > > > > hw.sensors.nmea0.indicator0=On (Signal), OK > > hw.sensors.nmea0.timedelta0=0.031653 secs (GPS autonomous), OK, Wed Aug 29 > > 21:48:52.031 > > hw.sensors.nmea0.angle0=xxxxxx degrees (Latitude), OK > > hw.sensors.nmea0.angle1=yyyyyy degrees (Longitude), OK > > > > ntpd thinks the sensor is invalid, but that's for more poking later. > > > > $ntpctl -s Sensors > > sensor > > wt gd st next poll offset correction > > nmea0 > > 1 0 0 2s 15s - sensor not valid - > > > > So here's the diff.. i wonder if we should just match the 3 chars for the > > 'RMC' > > message. > > I think it should match all the currently known ones, including the first > two characters.
Well, let's match on the 5 'most common' used, otherwise there's many more.. cf http://www.catb.org/gpsd/NMEA.html#_talker_ids Would there be interest in adding support for speed/elevation to sensors provided by nmea(4) ? As the data is available anyway on the wire.. (altitude in the GGA messages, and RMC has the ground speed in knots) Index: tty_nmea.c =================================================================== RCS file: /cvs/src/sys/kern/tty_nmea.c,v retrieving revision 1.46 diff -u -r1.46 tty_nmea.c --- tty_nmea.c 19 Feb 2018 08:59:52 -0000 1.46 +++ tty_nmea.c 30 Aug 2018 05:46:29 -0000 @@ -260,8 +260,20 @@ } } - /* we only look at the GPRMC message */ - if (strcmp(fld[0], "GPRMC")) + /* + * we only look at the RMC message, which can come from different 'talkers', + * distinguished by the two-chars prefix, the most common being: + * GPS (GP) + * Glonass (GL) + * BeiDou (BD) + * Galileo (GA) + * 'Any kind/a mix of GNSS systems' (GN) + */ + if (strcmp(fld[0], "BDRMC") && + strcmp(fld[0], "GARMC") && + strcmp(fld[0], "GLRMC") && + strcmp(fld[0], "GNRMC") && + strcmp(fld[0], "GPRMC")) return; /* if we have a checksum, verify it */
