From: landry Date: Sat, 1 Sep 2018 06:09:26 +0000 (+0000) Subject: Recognize more talker IDs when parsing NMEA RMC messages X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ba7bb6872abcd0eb3c6d1a60ed204c883e564566;p=openbsd 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@ --- 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 @@ -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 */