NMEA(4)

πŸ“¦ in nixpkgs unstable

πŸ›°οΈ 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 the RMC message 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 like ntpd(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 those WARNs and CRITICALs β€” 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms