xref: /openbsd-src/share/man/man4/nmea.4 (revision 2b0358df1d88d06ef4139321dd05bd5e05d91eaf)
1.\"	$OpenBSD: nmea.4,v 1.22 2008/05/06 09:01:08 mbalmer Exp $
2.\"
3.\" Copyright (c) 2006, 2007 Marc Balmer <mbalmer@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: May 6 2008 $
18.Dt NMEA 4
19.Os
20.Sh NAME
21.Nm nmea
22.Nd NMEA 0183 timedelta sensor
23.Sh SYNOPSIS
24.Cd "pseudo-device nmea" Op Ar count
25.Sh DESCRIPTION
26This line discipline interfaces NMEA devices,
27such as GPS receivers attached to a serial or USB port.
28.Pp
29The line discipline is enabled by the following sequence:
30.Bd -literal -offset indent
31#include <sys/ttycom.h>
32int ldisc = NMEADISC, fildes; ...
33ioctl(fildes, TIOCSETD, &ldisc);
34.Ed
35.Pp
36The byte stream is unaltered by the line discipline which
37maintains a timedelta sensor using the NMEA data.
38The timedelta sensor will appear as nmea* in the list of sensors and the delta
39(in nanoseconds) between the received time information and the local time can
40be accessed through the
41.Xr sysctl 8
42interface.
43.Sh NMEA SENTENCES
44The
45.Nm
46line discipline decodes the following NMEA 0183 sentences:
47.Bl -tag -width "GPRMCXX"
48.It GPRMC
49Recommended Minimum Specific GPS/TRANSIT Data.
50Only the time and date information is extracted.
51The warning indication is used to provide the sensor status (see below).
52If the attached device sends the GPRMC message in the 13-field format,
53the operation mode of the GPS device is reported in the sensor description.
54The sensor timestamp is copied from the tty timestamp if a device with PPS
55is being used and tty timestamping has been turned on.
56Otherwise the sensor timestamp is taken when the initial `$' character of
57a message block is received from the NMEA device.
58.El
59.Sh SENSOR STATES
60The quality of the timedelta is reported as the sensor status:
61.Bl -tag -width "CRITICALXX" -offset indent
62.It OK
63The time information is valid.
64The timedelta is safe to use for applications like
65.Xr ntpd 8 .
66.It WARN
67The attached GPS receiver has been indicating a warning condition
68for at least the last ten minutes.
69The timedelta should be used with care.
70.It CRITICAL
71tty timestamping has been turned on but there is no PPS signal present or the
72GPS receiver indicated a warning condition for at least the last twenty
73minutes.
74Check your hardware.
75Some GPS units need PPS to be manually turned on.
76.El
77.Pp
78The status of a second sensor is used to report the status of the
79device itself:
80.Bl -tag -width "CRITICALXX" -offset indent
81.It OK
82The clock is synchronized, e.g. a GPS receiver has a fix.
83.It WARN
84The device issued a warning condition, e.g. a GPS receiver has no fix.
85.El
86.Sh SEE ALSO
87.Xr tty 4 ,
88.Xr ldattach 8 ,
89.Xr ntpd 8 ,
90.Xr sysctl 8
91.Sh HISTORY
92The
93.Nm
94interface first appeared in
95.Ox 4.0 .
96.Sh AUTHORS
97The
98.Nm
99line discipline was written by
100.An Marc Balmer Aq mbalmer@openbsd.org .
101