NMEA(4)
π°οΈ NMEA(4) β the nmea manual, bestie edition β¨
okay so you found a nmea man page and you're like "what is this even" β don't worry, I got you π this is from the Kernel Interfaces Manual section, and honestly it's giving niche-but-iconic. let's get into it π
πΈ NAME πΈ
nmea β the NMEA 0183 timedelta sensor. that's the whole vibe β¨
π¦ SYNOPSIS π¦
pseudo-device nmea [count]
yep, that's it. one line. she's lowkey mysterious like that π
π DESCRIPTION π
so this line discipline is literally the translator between your kernel and NMEA devices β think GPS receivers plugged into a serial or USB port. main character hardware energy π₯
to turn the line discipline on, you run this sequence, no cap:
#include <sys/ioctl.h>
int ldisc = NMEADISC, fildes; ...
ioctl(fildes, TIOCSETD, &ldisc);
here's the tea: the byte stream is completely unaltered by the line discipline π«Ά it just quietly maintains timedelta and position sensors using the NMEA data. those sensors show up as nmea* in the list β you'll spot them, they're literally right there π
and what can you actually get out of it? the timedelta (that's the nanoseconds difference between the received time information and the local time), the position (calculated latitude and longitude in degrees), altitude, and speed β all accessible through the sysctl(8) interface. slay π
π§ NMEA 0183 sentences it decodes π§
the nmea line discipline decodes these, and only these:
RMCβ Recommended Minimum Specific GPS/TRANSIT Data. the time and date information, position and speed are extracted. the warning indication is used to provide the sensor status (peep the next section, it's right there π). if the attached device sends theRMCmessage in the 13-field format, the operation mode of the GPS device is reported in the sensor description. the sensor timestamp is copied from the tty timestamp if a device with PPS is being used and tty timestamping has been turned on. otherwise the sensor timestamp is taken when the initial$character of a message block is received from the NMEA device. periodt. πGGAβ Current fix data. the altitude in meters is extracted. just that. iconic minimalism β¨
π message source prefixes π
messages source are recognised by the first two characters of the NMEA sentence, according to these prefixes β memorize them, there's a vibe check at the end of the semester π
GP GPS
GA Galileo
BD BeiDou
GL Glonass
GN Generic GNSS
π SENSOR STATES π
the quality of the timedelta is reported as the sensor status. here's the breakdown bestie:
OKβ the time information and position are valid. the timedelta is safe to use for applications likentpd(8). go off, king πWARNβ the attached GPS receiver has been indicating a warning condition for at least the last ten minutes. the timedelta should be used with care. like, she's fine but keep an eye on her πCRITICALβ tty timestamping has been turned on but there is no PPS signal present, or the GPS receiver indicated a warning condition for at least the last twenty minutes. check your hardware. some GPS units need PPS to be manually turned on. this is the "call your bestie at 3am" state π¨
πΈ second sensor, different job πΈ
the status of a second sensor is used to report the status of the device itself:
OKβ the clock is synchronized, e.g. a GPS receiver has a fix. we love a functioning device πWARNβ the device issued a warning condition, e.g. a GPS receiver has no fix. it's giving lost π
ngl, keep an eye on thoseWARNs andCRITICALs β they're not just decorative, they're literally the hardware telling you something π
π«Ά SEE ALSO π«Ά
tty(4), ldattach(8), ntpd(8), sysctl(8)
β HISTORY β
the nmea interface first appeared in OpenBSD 4.0. vintage. retro. we stan a legacy icon π
π AUTHORS π
the nmea line discipline was written by Marc Balmer <mbalmer@openbsd.org>. thank you for your service king π«‘π
and that's the whole page, bestie! it's from Debian, dated January 27, 2019 β so when you cite it, you cite it right πβ¨π¦
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2006, 2007 Marc Balmer <mbalmer@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms