xref: /openbsd/share/man/man4/nmea.4 (revision 17df1aa7)
1.\"	$OpenBSD: nmea.4,v 1.23 2010/04/21 23:43:39 sthen 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: April 21 2010 $
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 timedelta and position sensors using the NMEA data.
38The sensors will appear as nmea* in the list.
39The timedelta (nanoseconds difference between the received time
40information and the local time), and position (calculated
41latitude and longitude in degrees) can be accessed through the
42.Xr sysctl 8
43interface.
44.Sh NMEA SENTENCES
45The
46.Nm
47line discipline decodes the following NMEA 0183 sentences:
48.Bl -tag -width "GPRMCXX"
49.It GPRMC
50Recommended Minimum Specific GPS/TRANSIT Data.
51The time and date information and position are extracted.
52The warning indication is used to provide the sensor status (see below).
53If the attached device sends the GPRMC message in the 13-field format,
54the operation mode of the GPS device is reported in the sensor description.
55The sensor timestamp is copied from the tty timestamp if a device with PPS
56is being used and tty timestamping has been turned on.
57Otherwise the sensor timestamp is taken when the initial `$' character of
58a message block is received from the NMEA device.
59.El
60.Sh SENSOR STATES
61The quality of the timedelta is reported as the sensor status:
62.Bl -tag -width "CRITICALXX" -offset indent
63.It OK
64The time information and position are valid.
65The timedelta is safe to use for applications like
66.Xr ntpd 8 .
67.It WARN
68The attached GPS receiver has been indicating a warning condition
69for at least the last ten minutes.
70The timedelta should be used with care.
71.It CRITICAL
72tty timestamping has been turned on but there is no PPS signal present or the
73GPS receiver indicated a warning condition for at least the last twenty
74minutes.
75Check your hardware.
76Some GPS units need PPS to be manually turned on.
77.El
78.Pp
79The status of a second sensor is used to report the status of the
80device itself:
81.Bl -tag -width "CRITICALXX" -offset indent
82.It OK
83The clock is synchronized, e.g. a GPS receiver has a fix.
84.It WARN
85The device issued a warning condition, e.g. a GPS receiver has no fix.
86.El
87.Sh SEE ALSO
88.Xr tty 4 ,
89.Xr ldattach 8 ,
90.Xr ntpd 8 ,
91.Xr sysctl 8
92.Sh HISTORY
93The
94.Nm
95interface first appeared in
96.Ox 4.0 .
97.Sh AUTHORS
98The
99.Nm
100line discipline was written by
101.An Marc Balmer Aq mbalmer@openbsd.org .
102