#!/usr/bin/tclsh8.4 if {[llength $argv] != 1} { error "need serial port arg" } set port [lindex $argv 0] set port_stty [exec stty -F $port -g] set term_stty [exec stty -g] set e [catch { exec stty min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \ -ctlecho -echo -echoe -echok -echonl -iexten -isig exec stty -F $port min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \ -ctlecho -echo -echoe -echok -echonl -iexten -isig \ 9600 clocal cread -crtscts -hup -parenb cs8 -cstopb \ -ixoff bs0 cr0 ff0 nl0 -ofill -olcuc -onlcr set p [open $port {RDWR|NONBLOCK} 0] fconfigure $p -blocking false -buffering none fconfigure stdin -blocking false -buffering none fconfigure stdin -blocking false -buffering none }] fconfigure stdin -blocking true exec stty $term_stty exec stty -F $port $port_stty