Landry Breuil <lan...@openbsd.org> 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.

> 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  29 Aug 2018 19:49:24 -0000
> @@ -261,7 +261,7 @@
>         }
>  
>         /* we only look at the GPRMC message */
> -       if (strcmp(fld[0], "GPRMC"))
> +       if (strcmp(fld[0], "GPRMC") && strcmp(fld[0], "GNRMC"))
>                 return;
>  
>         /* if we have a checksum, verify it */
> 

Reply via email to