From 08acaf69dddd69ae4dba9d25de9d3cd72b9bb260 Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sun, 29 May 2022 16:35:22 -0700 Subject: Move stty setup/teardown to separate script; add hconnect script. --- tool/withstty | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 tool/withstty (limited to 'tool/withstty') diff --git a/tool/withstty b/tool/withstty new file mode 100755 index 0000000..9f23565 --- /dev/null +++ b/tool/withstty @@ -0,0 +1,38 @@ +#!/bin/bash + +set -eu + +OLD_SETTINGS="$(stty -g -F /dev/ttyUSB0)" + +stty -F /dev/ttyUSB0 \ + 1000000 \ + -drain \ + -clocal \ + cread \ + crtscts \ + cs8 \ + cstopb \ + -hup \ + parenb \ + parodd \ + -cmspar \ + -igncr \ + ignpar \ + -parmrk \ + inpck \ + -istrip \ + -ixany \ + -ixoff \ + -ixon \ + -echo \ + -icanon \ + -onlcr + +set +e +"$@" +ERROR="$?" +set -e + +stty -drain "$OLD_SETTINGS" -F /dev/ttyUSB0 2> /dev/null + +exit "$ERROR" -- cgit v1.2.3