summaryrefslogtreecommitdiff
path: root/tool/withstty
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-05-29 16:35:22 -0700
committerJulian Blake Kongslie2022-05-29 16:35:22 -0700
commit08acaf69dddd69ae4dba9d25de9d3cd72b9bb260 (patch)
tree2a48dc70b0b4365b18276fc20cd694c1ec5c9729 /tool/withstty
parentSingle-cycle bypass when there is no contention on memory arbiter. (diff)
downloadmultipdp8-08acaf69dddd69ae4dba9d25de9d3cd72b9bb260.tar.xz
Move stty setup/teardown to separate script; add hconnect script.
Diffstat (limited to 'tool/withstty')
-rwxr-xr-xtool/withstty38
1 files changed, 38 insertions, 0 deletions
diff --git a/tool/withstty b/tool/withstty
new file mode 100755
index 0000000..9f23565
--- /dev/null
+++ b/tool/withstty
@@ -0,0 +1,38 @@
1#!/bin/bash
2
3set -eu
4
5OLD_SETTINGS="$(stty -g -F /dev/ttyUSB0)"
6
7stty -F /dev/ttyUSB0 \
8 1000000 \
9 -drain \
10 -clocal \
11 cread \
12 crtscts \
13 cs8 \
14 cstopb \
15 -hup \
16 parenb \
17 parodd \
18 -cmspar \
19 -igncr \
20 ignpar \
21 -parmrk \
22 inpck \
23 -istrip \
24 -ixany \
25 -ixoff \
26 -ixon \
27 -echo \
28 -icanon \
29 -onlcr
30
31set +e
32"$@"
33ERROR="$?"
34set -e
35
36stty -drain "$OLD_SETTINGS" -F /dev/ttyUSB0 2> /dev/null
37
38exit "$ERROR"