summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kerns <david.t.kerns@gmail.com>2022-02-09 23:33:00 +0200
committerAlexander Naumov <alexander_naumov@opensuse.org>2022-02-09 23:33:00 +0200
commit8b386d8dec851e3f80130b82fd3a9f7e22625c39 (patch)
tree17fb89d73f7839ae99699facc028fc110a874fa6
parentafa966c7883636c259ce0158944314a563180f49 (diff)
downloadscreen-8b386d8dec851e3f80130b82fd3a9f7e22625c39.tar.gz
Support stop/parity bits on serial port
bug #23952 Unfortunately, screen's handling of serial ports is somewhat incomplete: You can set the baud rate and the word length (cs7), but not the number of stop bits and/or the parity settings. Since the OS calls are readily available, adding this to a future version of screen would proably be easy enough to do inside tty.sh.
-rw-r--r--src/doc/screen.16
-rw-r--r--src/doc/screen.texinfo6
-rw-r--r--src/tty.sh48
3 files changed, 60 insertions, 0 deletions
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index e36cd9a..d10d683 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -3970,6 +3970,12 @@ in the notation used by stty(1):
Usually 300, 1200, 9600 or 19200. This affects transmission as well as receive speed.
.IP "cs8 or cs7"
Specify the transmission of eight (or seven) bits per byte.
+.IP "cstopb or \-cstopb"
+Specify two stop bits per character (one with '-')
+.IP "parenb or \-parenb"
+Generate parity bit in output and expect parity bit in input
+.IP "parodd or \-parodd"
+Set odd parity (or even parity with '-')
.IP "ixon or \-ixon"
Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data.
.IP "ixoff or \-ixoff"
diff --git a/src/doc/screen.texinfo b/src/doc/screen.texinfo
index e706833..9f160d3 100644
--- a/src/doc/screen.texinfo
+++ b/src/doc/screen.texinfo
@@ -1424,6 +1424,12 @@ Usually 300, 1200, 9600 or 19200. This affects transmission as well as
receive speed.
@item cs8 or cs7
Specify the transmission of eight (or seven) bits per byte.
+@item cstopb or -cstopb
+Specify two (or one) stop bits per character
+@item parenb or -parenb
+Generate parity bit in output and expect parity bit in input
+@item parodd or -parodd
+Set odd (or even) parity
@item ixon or -ixon
Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending
data.
diff --git a/src/tty.sh b/src/tty.sh
index d408720..bd1a0e6 100644
--- a/src/tty.sh
+++ b/src/tty.sh
@@ -671,6 +671,54 @@ int SttyMode(struct mode *m, char *opt)
#endif
}
+ else if (!strncmp("parenb", opt, 6)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag |= PARENB;
+#else
+ debug("SttyMode: no parenb in old bsd land.\n");
+#endif
+ }
+
+ else if (!strncmp("-parenb", opt, 6)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag &= ~PARENB;
+#else
+ debug("SttyMode: no -parenb in old bsd land.\n");
+#endif
+ }
+
+ else if (!strncmp("parodd", opt, 6)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag |= PARODD;
+#else
+ debug("SttyMode: no parodd in old bsd land.\n");
+#endif
+ }
+
+ else if (!strncmp("-parodd", opt, 6)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag &= ~PARODD;
+#else
+ debug("SttyMode: no -parodd in old bsd land.\n");
+#endif
+ }
+
+ else if (!strncmp("cstopb", opt, 6)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag |= CSTOPB;
+#else
+ debug("SttyMode: no cstopb in old bsd land.\n");
+#endif
+ }
+
+ else if (!strncmp("-cstopb", opt, 7)) {
+#if defined(POSIX) || defined(TERMIO)
+ m->tio.c_cflag &= ~CSTOPB;
+#else
+ debug("SttyMode: no -cstopb in old bsd land.\n");
+#endif
+ }
+
else if (!strncmp("istrip", opt, 6)) {
#if defined(POSIX) || defined(TERMIO)
m->tio.c_iflag |= ISTRIP;