diff options
author | Marc Balmer <mbalmer@cvs.openbsd.org> | 2008-01-05 17:33:29 +0000 |
---|---|---|
committer | Marc Balmer <mbalmer@cvs.openbsd.org> | 2008-01-05 17:33:29 +0000 |
commit | 2a0eec3d922ea9fda272a0a239ac6eb30cadc40b (patch) | |
tree | d48c394d5a9db8c4f953389e4ff44df8005b4fbb /sbin | |
parent | f1d430b3cf60f8e6d4f5810bcde9bc17bd36ac8c (diff) |
Add support for the Meinberg Standard Time String format that all Meinberg
radio clocks can transmit over serial ports. This is implemented as a
line discipline similar to nmea(4) and provides a timedelta sensor.
See http://www.meinberg.de/english/specs/timestr.htm for details on the
MSTS format.
ldattach(8) is extended to support the "msts" line discipline and two stopbits
(which some radio clocks, e.g. the C51 use). Do a "make includes" before your
next system build.
Initially from Maurice Janssen based on nmea(4). "go for it" deraadt
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ldattach/ldattach.8 | 19 | ||||
-rw-r--r-- | sbin/ldattach/ldattach.c | 20 |
2 files changed, 29 insertions, 10 deletions
diff --git a/sbin/ldattach/ldattach.8 b/sbin/ldattach/ldattach.8 index 752c7053a9e..00d69a29b28 100644 --- a/sbin/ldattach/ldattach.8 +++ b/sbin/ldattach/ldattach.8 @@ -1,6 +1,6 @@ -.\" $OpenBSD: ldattach.8,v 1.8 2007/11/13 21:44:55 jmc Exp $ +.\" $OpenBSD: ldattach.8,v 1.9 2008/01/05 17:33:28 mbalmer Exp $ .\" -.\" Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> +.\" Copyright (c) 2007, 2008 Marc Balmer <mbalmer@openbsd.org> .\" .\" Permission to use, copy, modify, and distribute this software for any .\" purpose with or without fee is hereby granted, provided that the above @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 13 2007 $ +.Dd $Mdocdate: January 5 2008 $ .Dt LDATTACH 8 .Os .Sh NAME @@ -22,7 +22,7 @@ .Nd attach a line discipline to a serial line .Sh SYNOPSIS .Nm ldattach -.Op Fl 7dehmo +.Op Fl 27dehmo .Op Fl s Ar baudrate .Op Fl t Ar cond .Ar discipline @@ -43,6 +43,8 @@ entries to attach line disciplines. .Pp The following options are available: .Bl -tag -width Ds +.It Fl 2 +Use 2 stopbits instead of 1. .It Fl 7 Use 7 databits instead of 8. .It Fl d @@ -64,7 +66,9 @@ If not specified, the default of 9600 baud is used .Xr nmea 4 ) . .It Fl t Ar cond .Xr nmea 4 -line discipline only. +and +.Xr msts 4 +line disciplines only. Chooses the condition which will cause the current system time to be immediately copied to the terminal timestamp storage for subsequent use by .Xr nmea 4 . @@ -90,6 +94,10 @@ character of each block of NMEA sentences. Specifies the name of the line discipline to be attached. .Pp .Bl -tag -width nmeaXX -offset -indet -compact +.It msts +Attach the +.Xr msts 4 +line discipline. .It nmea Attach the .Xr nmea 4 @@ -141,6 +149,7 @@ add a line of the following form to tty01 "/sbin/ldattach nmea" unknown on softcar .Ed .Sh SEE ALSO +.Xr msts 4 , .Xr nmea 4 , .Xr sl 4 , .Xr tty 4 , diff --git a/sbin/ldattach/ldattach.c b/sbin/ldattach/ldattach.c index eb8ae9a1eef..19667b08ed7 100644 --- a/sbin/ldattach/ldattach.c +++ b/sbin/ldattach/ldattach.c @@ -1,7 +1,7 @@ -/* $OpenBSD: ldattach.c,v 1.3 2007/11/13 19:32:34 mbalmer Exp $ */ +/* $OpenBSD: ldattach.c,v 1.4 2008/01/05 17:33:28 mbalmer Exp $ */ /* - * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> + * Copyright (c) 2007, 2008 Marc Balmer <mbalmer@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -47,7 +47,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-7dehmo] [-s baudrate] " + fprintf(stderr, "usage: %s [-27dehmo] [-s baudrate] " "[-t cond] discipline device\n", __progname); exit(1); } @@ -61,7 +61,7 @@ main(int argc, char *argv[]) sigset_t sigset; pid_t ppid; int ch, fd, ldisc, nodaemon = 0; - int bits = 0, parity = 0, flowcl = 0, hupcl = 1; + int bits = 0, parity = 0, stop = 0, flowcl = 0, hupcl = 1; speed_t speed = 0; char devn[32], *dev, *disc; @@ -70,8 +70,11 @@ main(int argc, char *argv[]) if ((ppid = getppid()) == 1) nodaemon = 1; - while ((ch = getopt(argc, argv, "7dehmos:t:")) != -1) { + while ((ch = getopt(argc, argv, "27dehmos:t:")) != -1) { switch (ch) { + case '2': + stop = 2; + break; case '7': bits = 7; break; @@ -143,6 +146,8 @@ main(int argc, char *argv[]) ldisc = NMEADISC; if (speed == 0) speed = B4800; /* default is 4800 baud for nmea */ + } else if (!strcmp(disc, "msts")) { + ldisc = MSTSDISC; } else { syslog(LOG_ERR, "unknown line discipline %s", disc); goto bail_out; @@ -180,6 +185,11 @@ main(int argc, char *argv[]) else tty.c_cflag &= ~PARODD; + if (stop == 2) + tty.c_cflag |= CSTOPB; + else + tty.c_cflag &= ~CSTOPB; + if (flowcl) tty.c_cflag |= CRTSCTS; |