Shop OBEX P1 Docs P2 Docs Learn Events
showtty - easy serial port settings — Parallax Forums

showtty - easy serial port settings

ArchiverArchiver Posts: 46,084
edited 2002-11-21 09:38 in General Discussion
When fiddling around with serial port settings on linux I used the
script below. It is just an interface to stty, but it provides an
easyly readable display of all the settings - overview and in detail -
and allows quick changes with just a few keystrokes.


#!/bin/bash

device=$1
option=""

if test "$device" = ""; then
device="/dev/ttyS0"
fi

if test "$2" != "noterm"; then
xterm +sb -bg black -fg white -e $0 $device noterm &
exit
fi

green="\033[noparse][[/noparse]32m"
white="\033[noparse][[/noparse]37m"
cyan="\033[noparse][[/noparse]36m"
yellow="\033[noparse][[/noparse]33m"
red="\033[noparse][[/noparse]31m"

while test 1; do
clear
echo -ne $yellow
echo $device


echo -ne $white
echo '

'

if test "$option" != ""; then
echo -ne $red
stty -F $device $option
fi

echo -ne $cyan
stty -F $device

echo -ne $white
echo '

'

echo -ne $green
stty -F $device -a

echo -e $white
echo -n '>>' && read option
done
Sign In or Register to comment.