.\" $OpenBSD: nmea.4,v 1.14 2007/03/19 13:52:34 jmc Exp $ .\" .\" Copyright (c) 2006, 2007 Marc Balmer .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above .\" copyright notice and this permission notice appear in all copies. .\" .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" .Dd September 3, 2006 .Dt NMEA 4 .Os .Sh NAME .Nm nmea .Nd line discipline for NMEA 0183 devices .Sh SYNOPSIS .Cd "pseudo-device nmea" Op Ar count .Sh DESCRIPTION This line discipline interfaces NMEA devices, such as GPS receivers attached to a serial or USB port. .Pp The line discipline is enabled by the following sequence: .Bd -literal -offset indent #include int ldisc = NMEADISC, fildes; ... ioctl(fildes, TIOCSETD, &ldisc); .Ed .Pp The byte stream is unaltered by the line discipline which maintains a timedelta sensor using the NMEA data. The timedelta sensor will appear as nmea* in the list of sensors and the delta (in nanoseconds) between the received time information and the local time can be accessed through the .Xr sysctl 8 interface. .Sh NMEA SENTENCES The .Nm line discipline decodes the following NMEA 0183 sentences: .Bl -tag -width "GPRMCXX" .It GPRMC Recommended Minimum Specific GPS/TRANSIT Data. Only the time and date information is extracted. The warning indication is used to provide the sensor status (see below). If the attached device sends the GPRMC 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. .El .Sh SENSOR STATES The quality of the timedelta is reported as the sensor status: .Bl -tag -width "WARNXX" .It OK The time information is valid. The timedelta is safe to use for applications like .Xr ntpd 8 . .It WARN The attached GPS receiver indicates a warning condition. The timedelta should be used with care. .It CRITICAL tty timestamping has been turned on but there is no PPS signal present. Check your hardware. Some GPS units need PPS to be manually turned on. .El .Sh SEE ALSO .Xr tty 4 , .Xr nmeaattach 8 , .Xr ntpd 8 , .Xr sysctl 8 .Sh HISTORY The .Nm interface first appeared in .Ox 4.0 . .Sh AUTHORS The .Nm line discipline was written by .An Marc Balmer Aq mbalmer@openbsd.org .