aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorStephen Hurd <shurd@FreeBSD.org>2019-06-12 18:07:04 +0000
committerStephen Hurd <shurd@FreeBSD.org>2019-06-12 18:07:04 +0000
commit705aad98c64572aefe9bdb8f1fd854f976c1b03d (patch)
treea16bee1d7069dfb81f667ff7dcbee04f821f542c /bin
parent0026d8ccb7296de6f66d3f2d2813b1a5f77b4035 (diff)
downloadsrc-705aad98c64572aefe9bdb8f1fd854f976c1b03d.tar.gz
src-705aad98c64572aefe9bdb8f1fd854f976c1b03d.zip
Some devices take undesired actions when RTS and DTR are
asserted. Some development boards for example will reset on DTR, and some radio interfaces will transmit on RTS. This patch allows "stty -f /dev/ttyu9.init -rtsdtr" to prevent RTS and DTR from being asserted on open(), allowing these devices to be used without problems. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D20031
Notes
Notes: svn path=/head/; revision=348999
Diffstat (limited to 'bin')
-rw-r--r--bin/stty/modes.c2
-rw-r--r--bin/stty/print.c6
-rw-r--r--bin/stty/stty.12
3 files changed, 10 insertions, 0 deletions
diff --git a/bin/stty/modes.c b/bin/stty/modes.c
index e34afb83ee38..0fe4e5168d2c 100644
--- a/bin/stty/modes.c
+++ b/bin/stty/modes.c
@@ -91,6 +91,8 @@ static const struct modes cmodes[] = {
{ "-rtsflow", 0, CRTS_IFLOW },
{ "mdmbuf", MDMBUF, 0 },
{ "-mdmbuf", 0, MDMBUF },
+ { "rtsdtr", 0, CNO_RTSDTR },
+ { "-rtsdtr", CNO_RTSDTR, 0 },
{ NULL, 0, 0 },
};
diff --git a/bin/stty/print.c b/bin/stty/print.c
index 03d5c3b8a770..a76cd46b765e 100644
--- a/bin/stty/print.c
+++ b/bin/stty/print.c
@@ -184,6 +184,12 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
put("-dsrflow", CDSR_OFLOW, 0);
put("-dtrflow", CDTR_IFLOW, 0);
put("-mdmbuf", MDMBUF, 0); /* XXX mdmbuf == dtrflow */
+ if (on(CNO_RTSDTR))
+ bput("-rtsdtr");
+ else {
+ if (fmt >= BSD)
+ bput("rtsdtr");
+ }
/* special control characters */
cc = tp->c_cc;
diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index a0f76fe2bfd1..1863c2286176 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -145,6 +145,8 @@ Assume a line without (with) modem
control.
.It Cm crtscts Pq Fl crtscts
Enable (disable) RTS/CTS flow control.
+.It Cm rtsdtr Pq Fl -rtsdtr
+Enable (disable) asserting RTS/DTR on open.
.El
.Ss Input Modes:
This corresponds to the c_iflag in the termios structure.