diff options
author | Landry Breuil <landry@cvs.openbsd.org> | 2018-09-01 06:09:27 +0000 |
---|---|---|
committer | Landry Breuil <landry@cvs.openbsd.org> | 2018-09-01 06:09:27 +0000 |
commit | 62f9a9419976733d0bd4fa6ff4089de6c41e6a64 (patch) | |
tree | 2f29cb510a9981cd089b93a5163ddcccc0e6be2e | |
parent | ea129de203957be52c0a959cd9d2cfebbea799e6 (diff) |
Recognize more talker IDs when parsing NMEA RMC messages
The NMEA 0183 standard says that the first two chars correspond to the
'source' of the message, right now we were only looking for 'GP' prefix
for 'GPS', but this can also be 'GL' for Glonass, 'BD' for BeiDou, 'GA'
for Galileo, or 'GN' for a generic GNSS source.
Match the RMC messages from all those variants, with this i'm able to
use my navilock nl-8002u (which uses GNRMC) as a timedelta sensor for
ntpd, and i have my GPS position in the nmea(4) sensors.
ok deraadt@
-rw-r--r-- | sys/kern/tty_nmea.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/kern/tty_nmea.c b/sys/kern/tty_nmea.c index 8578fee59ca..fafca388b14 100644 --- a/sys/kern/tty_nmea.c +++ b/sys/kern/tty_nmea.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty_nmea.c,v 1.46 2018/02/19 08:59:52 mpi Exp $ */ +/* $OpenBSD: tty_nmea.c,v 1.47 2018/09/01 06:09:26 landry Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Marc Balmer <mbalmer@openbsd.org> @@ -260,8 +260,20 @@ nmea_scan(struct nmea *np, struct tty *tp) } } - /* 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 */ |