OpenBSD CVS

CVS log for src/sys/kern/tty_nmea.c


[BACK] Up to [local] / src / sys / kern

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.51 / (download) - annotate - [select for diffs], Sat Apr 2 22:45:18 2022 UTC (2 years, 2 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, HEAD
Changes since 1.50: +5 -2 lines
Diff to previous 1.50 (colored)

Update an old comment

The old comment only mentioned that tty_nmea was used for time, but
subsequently position data was added to this line discipline.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Apr 2 22:43:01 2022 UTC (2 years, 2 months ago) by mlarkin
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

whitespace fix

Revision 1.49 / (download) - annotate - [select for diffs], Thu Aug 15 15:08:14 2019 UTC (4 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.48: +4 -4 lines
Diff to previous 1.48 (colored)

NMEA 4.1 has one more field in the RMC message; ok kettenis@

Revision 1.48 / (download) - annotate - [select for diffs], Sat Jan 26 22:51:13 2019 UTC (5 years, 4 months ago) by landry
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.47: +105 -8 lines
Diff to previous 1.47 (colored)

Parse altitude and ground speed values from the GGA & RMC NMEA messages,
and provide them as nmea(4) distance & velocity sensors.

With my 'u-blox GNSS receiver' that gives:

hw.sensors.nmea0.distance0=335.600 m (Altitude), OK
hw.sensors.nmea0.velocity0=18.337 m/s (Ground speed), OK

ok deraadt@

Revision 1.47 / (download) - annotate - [select for diffs], Sat Sep 1 06:09:26 2018 UTC (5 years, 9 months ago) by landry
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.46: +15 -3 lines
Diff to previous 1.46 (colored)

Recognize more talker IDs when parsing NMEA RMC messages

The NMEA 0183 standard says that the first two chars correspond to the
'source' of the message, right now we were only looking for 'GP' prefix
for 'GPS', but this can also be 'GL' for Glonass, 'BD' for BeiDou, 'GA'
for Galileo, or 'GN' for a generic GNSS source.

Match the RMC messages from all those variants, with this i'm able to
use my navilock nl-8002u (which uses GNRMC) as a timedelta sensor for
ntpd, and i have my GPS position in the nmea(4) sensors.

ok deraadt@

Revision 1.46 / (download) - annotate - [select for diffs], Mon Feb 19 08:59:52 2018 UTC (6 years, 3 months ago) by mpi
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

Remove almost unused `flags' argument of suser().

The account flag `ASU' will no longer be set but that makes suser()
mpsafe since it no longer mess with a per-process field.

No objection from millert@, ok tedu@, bluhm@

Revision 1.45 / (download) - annotate - [select for diffs], Mon Dec 21 21:49:02 2015 UTC (8 years, 5 months ago) by sf
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.44: +1 -4 lines
Diff to previous 1.44 (colored)

Move ppp, nmea, endrun, and msts prototypes to tty.h

Fix inconsistent arguments for pppopen/pppclose/pppstart.
Use passed in argument p in pppopen instead of curproc.

"Looks good to me" deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Mon Nov 3 03:08:00 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.43: +3 -3 lines
Diff to previous 1.43 (colored)

pass size argument to free()
ok doug tedu

Revision 1.43 / (download) - annotate - [select for diffs], Sun Sep 14 14:17:26 2014 UTC (9 years, 8 months ago) by jsg
Branch: MAIN
Changes since 1.42: +1 -2 lines
Diff to previous 1.42 (colored)

remove uneeded proc.h includes
ok mpi@ kspillner@

Revision 1.42 / (download) - annotate - [select for diffs], Sat Jul 12 18:43:32 2014 UTC (9 years, 10 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)

add a size argument to free. will be used soon, but for now default to 0.
after discussions with beck deraadt kettenis.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Mar 21 21:54:14 2014 UTC (10 years, 2 months ago) by andre
Branch: MAIN
Changes since 1.40: +3 -2 lines
Diff to previous 1.40 (colored)

Fix missing brackets: longitude/latitude status set to critical every time
nmea_timeout() is triggered introduced in rev 1.37.

ok sthen@

Revision 1.40 / (download) - annotate - [select for diffs], Fri Mar 21 21:46:47 2014 UTC (10 years, 2 months ago) by andre
Branch: MAIN
Changes since 1.39: +14 -13 lines
Diff to previous 1.39 (colored)

Some knf, no functional changes.

ok sthen@

Revision 1.39 / (download) - annotate - [select for diffs], Thu May 27 17:18:23 2010 UTC (14 years ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.38: +9 -6 lines
Diff to previous 1.38 (colored)

Switch the signal status "percent" sensor, which is currently
hardcoded(!), over to an "indicator" sensor type, value depending
on whether the GPS has fix.  ok deraadt@

Revision 1.38 / (download) - annotate - [select for diffs], Fri Apr 23 03:44:44 2010 UTC (14 years, 1 month ago) by miod
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Remove unnecessary pointer dereference causing gcc2 to warn.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Apr 21 23:43:39 2010 UTC (14 years, 1 month ago) by sthen
Branch: MAIN
Changes since 1.36: +63 -52 lines
Diff to previous 1.36 (colored)

Provide nmea(4) position information using the new angle sensor type.
Use SENSOR_FINVALID until we have good data, suggested by deraadt@
"i am happy" deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Mon Apr 12 12:57:52 2010 UTC (14 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.35: +7 -8 lines
Diff to previous 1.35 (colored)

Some of the line disciplines want to check for suser.  Better to pass them
a process instead of using curproc.  ok deraadt

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jun 2 21:17:35 2009 UTC (15 years ago) by ckuethe
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.34: +8 -4 lines
Diff to previous 1.34 (colored)

Add some extra protection against non-monotonic timestamps. ok stevesk

Revision 1.34 / (download) - annotate - [select for diffs], Sun Apr 26 02:25:36 2009 UTC (15 years, 1 month ago) by cnst
Branch: MAIN
Changes since 1.33: +1 -3 lines
Diff to previous 1.33 (colored)

don't zero sensor .value and .flags immediately after the allocation w/ M_ZERO; ok deraadt

Revision 1.33 / (download) - annotate - [select for diffs], Thu Dec 25 21:25:55 2008 UTC (15 years, 5 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.32: +1 -2 lines
Diff to previous 1.32 (colored)

don't need #include <sys/queue.h>; ok mbalmer@
CVS ---------------------------------------------------------------------

Revision 1.32 / (download) - annotate - [select for diffs], Thu Dec 25 21:04:36 2008 UTC (15 years, 5 months ago) by stevesk
Branch: MAIN
Changes since 1.31: +2 -2 lines
Diff to previous 1.31 (colored)

spelling in comments; ok mbalmer@

Revision 1.31 / (download) - annotate - [select for diffs], Wed Sep 10 14:01:23 2008 UTC (15 years, 8 months ago) by blambert
Branch: MAIN
Changes since 1.30: +4 -11 lines
Diff to previous 1.30 (colored)

Convert timeout_add() calls using multiples of hz to timeout_add_sec()

Really just the low-hanging fruit of (hopefully) forthcoming timeout
conversions.

ok art@, krw@

Revision 1.30 / (download) - annotate - [select for diffs], Tue Jul 22 06:06:47 2008 UTC (15 years, 10 months ago) by mbalmer
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.29: +13 -8 lines
Diff to previous 1.29 (colored)

deactivate the code to display location in the sensor description

Revision 1.29 / (download) - annotate - [select for diffs], Mon Jul 7 08:01:47 2008 UTC (15 years, 10 months ago) by mbalmer
Branch: MAIN
Changes since 1.28: +14 -9 lines
Diff to previous 1.28 (colored)

Shorten the sensor description and reserve room for optional characters
only when they are needed.  Makes locations like -123d45m,-123d45m fit.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jul 6 21:03:13 2008 UTC (15 years, 11 months ago) by mbalmer
Branch: MAIN
Changes since 1.27: +58 -1 lines
Diff to previous 1.27 (colored)

Add the position to the sensor description.

discussed with otto, sthen, ckuethe.  ok otto

Revision 1.27 / (download) - annotate - [select for diffs], Wed Jun 11 17:11:36 2008 UTC (15 years, 11 months ago) by mbalmer
Branch: MAIN
Changes since 1.26: +6 -3 lines
Diff to previous 1.26 (colored)

Don't use the reference count to create the sensor name; we can end up
with sensors with the same name.  The sensor name is now ever increasing
unless the reference count drops to zero, in which case the naming restarts
at zero as well.

Revision 1.26 / (download) - annotate - [select for diffs], Mon May 5 19:57:01 2008 UTC (16 years, 1 month ago) by mbalmer
Branch: MAIN
Changes since 1.25: +15 -5 lines
Diff to previous 1.25 (colored)

Make nmea(4) behave like the other timedelta sensors and provide a
signal sensor that reflects the status of the receiver.

tested by and ok ckuethe

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jan 28 20:32:50 2008 UTC (16 years, 4 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

spelling in comment; ok mbalmer@ jmc@

Revision 1.24 / (download) - annotate - [select for diffs], Tue Nov 27 10:06:55 2007 UTC (16 years, 6 months ago) by mbalmer
Branch: MAIN
Changes since 1.23: +6 -5 lines
Diff to previous 1.23 (colored)

Only checksum the NMEA sentence if it as GPRMC message.
suggested by otto.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Nov 26 19:14:38 2007 UTC (16 years, 6 months ago) by mbalmer
Branch: MAIN
Changes since 1.22: +66 -21 lines
Diff to previous 1.22 (colored)

Degrade the timedelta if the GPS reports a warning condition for more than
ten minutes (or if a serial GPS is disconnect and we get no NMEA sentences
at all).

ok otto

Revision 1.22 / (download) - annotate - [select for diffs], Fri Sep 7 15:00:20 2007 UTC (16 years, 8 months ago) by art
Branch: MAIN
Changes since 1.21: +2 -3 lines
Diff to previous 1.21 (colored)

Use M_ZERO in a few more places to shave bytes from the kernel.

eyeballed and ok dlg@

Revision 1.21 / (download) - annotate - [select for diffs], Thu Mar 22 16:55:31 2007 UTC (17 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.20: +3 -3 lines
Diff to previous 1.20 (colored)

split userland & kernel struct sensor/sensordev so that the addition
of new fields in the future is less disruptive.  This is done similar
to how struct proc is handled for ps(1).  ok jmc (man page changes)
tested fkr simon, and more suggestions from millert

Revision 1.20 / (download) - annotate - [select for diffs], Tue Mar 20 20:14:29 2007 UTC (17 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

swiss spelling

Revision 1.19 / (download) - annotate - [select for diffs], Mon Mar 19 06:37:01 2007 UTC (17 years, 2 months ago) by mbalmer
Branch: MAIN
Changes since 1.18: +78 -104 lines
Diff to previous 1.18 (colored)

Change the way the nmea(4) line discipline takes the timestamp for
the timedelta sensor when no PPS signal is available.

Previously, the timestamp was taken at the leading '$' character
of a GPRMC message, which was not always correct, as some GPS units
send other messages first; we do not know when the GPRMC message
is sent within a data block (we refer to a data block as the set
of NMEA messages that are sent by a GPS unit in one go, usually
once per second).

nmea(4) now takes the timestamp at the first '$' character received
after the start of a new seconds.  Since GPS units transmit a data
block every second, the first message can be found by measuring the
gap between consecutive messages:  after the longest gap, the first
message of the next second follows.  And it is at the leading '$'
character of this message that we take the timestamp.

$GPGGA,.....    <- take timestamp here
$GPGSA,.....
$GPRMC,.....    <- decode time here
...             <- possibly more messages
		<- longer gap till start of next second
$GPGGA,.....	<- it starts all over, take next timestamp

This code has been designed to work independent of the baudrate and
the rate at which the GPS sends out it's data blocks (usually 1 Hz,
but 5 Hz units are common as well):

With this change, precision is greatly improved in the absence of a
PPS signal and as a side effect, jitter is reduced.

Note that while this is much better than before, there is still a
slight offset to the real time, as calculating the fix in the GPS unit
and transmitting the '$' character takes a short, but unpredictable
amount of time.

When tty timestamping is enabled, but there is no PPS signal available,
the sensor status will be degraded to CRITICAL, which means "check your
hardware".

Thanks to Chris Kuethe for testing and feedback.  ok ckuethe.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Mar 5 10:23:16 2007 UTC (17 years, 3 months ago) by mbalmer
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.17: +40 -10 lines
Diff to previous 1.17 (colored)

If tty-timestamping is requested, but no PPS signal is present, output a
warning message and unconditionally set the sensor state to WARNING.

discussed with otto, ckuethe; ok otto, "i like it" ckuethe

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jan 2 22:43:29 2007 UTC (17 years, 5 months ago) by mbalmer
Branch: MAIN
Changes since 1.16: +11 -11 lines
Diff to previous 1.16 (colored)

return is not a function.

Revision 1.16 / (download) - annotate - [select for diffs], Sat Dec 23 17:46:38 2006 UTC (17 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.15: +8 -14 lines
Diff to previous 1.15 (colored)

adapt to new two-level sensor api; Constantine A. Murenin

Revision 1.15 / (download) - annotate - [select for diffs], Sat Dec 23 08:29:39 2006 UTC (17 years, 5 months ago) by mbalmer
Branch: MAIN
Changes since 1.14: +6 -3 lines
Diff to previous 1.14 (colored)

in nmeaopen(), only add the sensors to the system if there was no error.

Revision 1.14 / (download) - annotate - [select for diffs], Fri Dec 15 16:49:39 2006 UTC (17 years, 5 months ago) by mbalmer
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Correct order of malloc(9) arguments.
Spotted by  Constantine A. Murenin <cnst+openbsd@bugmail.mojo.ru>; thanks.

Revision 1.13 / (download) - annotate - [select for diffs], Wed Nov 29 13:26:50 2006 UTC (17 years, 6 months ago) by mbalmer
Branch: MAIN
Changes since 1.12: +33 -26 lines
Diff to previous 1.12 (colored)

Update the sensor description based on the GPS operation mode.  Initial
diff received from matthieu.
ok matthieu

Revision 1.12 / (download) - annotate - [select for diffs], Tue Nov 28 17:20:25 2006 UTC (17 years, 6 months ago) by mbalmer
Branch: MAIN
Changes since 1.11: +42 -17 lines
Diff to previous 1.11 (colored)

Let nmea(4) use tty timestamps if they are enabled.  Using a GPS receiver
that provides a PPS signal, more precision and less jitter can be expected.
With my test setting (a Garmin GPS 18 LVC hooked up to a i386 machine) I
observed a skew of 0.03 to 0.05 seconds between the tty timestamp and the soft
timestamp.

"put it in" deraadt

Revision 1.11 / (download) - annotate - [select for diffs], Sat Nov 18 08:20:51 2006 UTC (17 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.10: +3 -3 lines
Diff to previous 1.10 (colored)

typos; from bret lambert

Revision 1.10 / (download) - annotate - [select for diffs], Wed Jun 21 06:24:50 2006 UTC (17 years, 11 months ago) by mbalmer
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.9: +22 -8 lines
Diff to previous 1.9 (colored)

If tty timestamping is enabled, copy the tty timestamp early to preserve
the value if it gets overwritten by other events.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Jun 20 14:06:21 2006 UTC (17 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +7 -19 lines
Diff to previous 1.8 (colored)

pruning; ok mbalmer

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jun 19 16:27:17 2006 UTC (17 years, 11 months ago) by mbalmer
Branch: MAIN
Changes since 1.7: +38 -133 lines
Diff to previous 1.7 (colored)

Remove the no longer needed date/time calculations.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Jun 13 07:01:59 2006 UTC (17 years, 11 months ago) by mbalmer
Branch: MAIN
Changes since 1.6: +106 -184 lines
Diff to previous 1.6 (colored)

Next round of clean-up:  Remove the ugly state machine and replace it with
a simpler function that splits the nmea sentence into fields, verifies the
checksum and eventually decodes the data (if it's a GPRMC sentence).
Ignore Loran-C for the moment, no one has such a receiver.  Loran-C can
easily be added later if we have a receiver to test with.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Jun 10 23:15:26 2006 UTC (17 years, 11 months ago) by mbalmer
Branch: MAIN
Changes since 1.5: +219 -68 lines
Diff to previous 1.5 (colored)

Add functions to decode date and time strings that make sure no invalid
information can be passed.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Jun 5 05:01:47 2006 UTC (18 years ago) by deraadt
Branch: MAIN
Changes since 1.4: +33 -28 lines
Diff to previous 1.4 (colored)

various cleanups; ok mbalmer

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jun 4 09:52:40 2006 UTC (18 years ago) by mbalmer
Branch: MAIN
Changes since 1.3: +7 -7 lines
Diff to previous 1.3 (colored)

- ntpd no longer needs the NTP identifier as part of a timedelta sensor
  description.
- create the timedelta sensors as early as possible, but mark them invalid
  as long as there is no real data.
- update docs accordingly

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 1 23:17:08 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (colored)

Avoid buffer overflow in case of oversized input.
ok mbalmber

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jun 1 22:32:46 2006 UTC (18 years ago) by ckuethe
Branch: MAIN
Changes since 1.1: +40 -37 lines
Diff to previous 1.1 (colored)

mbalmer says the swiss have learned how to swim.

- fixed debug printfs
- cope with nmea0183 or nmea 2.3
- allow multiple receivers at the same time

Hacked in the park in downtown...

"commit this right away" mbalmer

Revision 1.1 / (download) - annotate - [select for diffs], Thu Jun 1 20:10:28 2006 UTC (18 years ago) by mbalmer
Branch: MAIN

Add basic NMEA0183 support as a tty line discipline.  The line discipline
decodes NMEA messages completely transparent to userland applications, i.e.
userland can still use the NMEA stream and talk to the device.  If data
is received, a timedelta sensor suitable for ntpd is created.  The timestamp
is not very precise at the moment, use of this is experimental at best.

"get it in or we see how well the swiss people can swim" deraadt@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.