3 if {[llength $argv] != 1} { error "need serial port arg" }
5 set port [lindex $argv 0]
7 set port_stty [exec stty -F $port -g]
8 set term_stty [exec stty -g]
21 exec stty min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
22 -ctlecho -echo -echoe -echok -echonl -iexten -isig
23 exec stty -F $port min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
24 -ctlecho -echo -echoe -echok -echonl -iexten -isig \
25 9600 clocal cread -crtscts -hup -parenb cs8 -cstopb \
26 -ixoff bs0 cr0 ff0 nl0 -ofill -olcuc -onlcr
27 set p [open $port {RDWR|NONBLOCK} 0]
28 fconfigure $p -blocking false -buffering none
29 fconfigure stdin -blocking false -buffering none
31 fileevent stdin readable onreadk
32 fileevent $p readable onreadp
35 fconfigure stdin -blocking true
37 exec stty -F $port $port_stty