chiark / gitweb /
848312e98e93f9e9595552bfacdaf98a121a454a
[chiark-utils.git] / scripts / hexterm
1 #!/usr/bin/tclsh8.4
2
3 if {[llength $argv] != 1} { error "need serial port arg" }
4
5 set port [lindex $argv 0]
6
7 set port_stty [exec stty -F $port -g]
8 set term_stty [exec stty -g]
9
10 set e [catch {
11     exec stty          min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
12                        -ctlecho -echo -echoe -echok -echonl -iexten -isig
13     exec stty -F $port min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
14                        -ctlecho -echo -echoe -echok -echonl -iexten -isig \
15             9600 clocal cread -crtscts -hup -parenb cs8 -cstopb \
16             -ixoff bs0 cr0 ff0 nl0 -ofill -olcuc -onlcr
17     set p [open $port {RDWR|NONBLOCK} 0]
18     fconfigure $p -blocking false -buffering none
19     fconfigure stdin -blocking false -buffering none
20     fconfigure stdin -blocking false -buffering none
21 }]
22
23 fconfigure stdin -blocking true
24 exec stty $term_stty
25 exec stty -F $port $port_stty