# Please email any bugs, comments, and/or additions to this file to:
# bug-dejagnu@gnu.org
-#
-# Connect to DEST using kermit. Note that we're just using kermit as a
+# Connect to DEST using Kermit. Note that we're just using Kermit as a
# simple serial or network connect program; we don't actually use Kermit
# protocol to do downloads.
-# returns -1 if it failed, otherwise it returns
-# the spawn_id.
#
-proc kermit_open { dest args } {
+# Returns -1 if it failed, otherwise it returns the spawn_id.
+#
+proc kermit_open {dest args} {
global spawn_id
global board_info
set result -1
verbose "kermit $device"
eval spawn kermit $device
- if { $spawn_id < 0 } {
- perror "invalid spawn id from kermit"
+ if {$spawn_id < 0} {
+ perror "invalid spawn id from Kermit"
return -1
}
warning "Never got prompt from Kermit."
set result -1
incr tries
- if { $tries <= 2 } {
+ if {$tries <= 2} {
exp_continue
}
}
perror "Never connected."
set result -1
incr tries
- if { $tries <= 2 } {
+ if {$tries <= 2} {
exp_continue
}
}
warning "Timed out trying to connect."
set result -1
incr tries
- if { $tries<=2 } {
+ if {$tries <= 2} {
exp_continue
}
}
}
- if { $result < 0 } {
+ if {$result < 0} {
perror "Couldn't connect after $tries tries."
if [info exists board_info($dest,fileid)] {
unset board_info($dest,fileid)
}
}
-#
# Send a list of commands to the Kermit session connected to DEST.
#
-proc kermit_command { dest args } {
+proc kermit_command {dest args} {
if [board_info $dest exists name] {
set dest [board_info $dest name]
}
set shell_id [board_info $dest fileid]
+
# Sometimes we have to send multiple ^\c sequences. Don't know
# why.
set timeout 2
- for { set i 1 } { $i <= 5 } { incr i } {
+ for {set i 1} {$i <= 5} {incr i} {
send -i $shell_id "\1cc"
expect {
- -i $shell_id -re ".*Back at.*ermit.*>.*$" { set i 10 }
+ -i $shell_id -re ".*Back at.*ermit.*>.*$" {set i 10}
-i $shell_id timeout {
- if { $i > 2 } {
+ if {$i > 2} {
warning "Unable to get prompt from kermit."
}
}
expect {
-i $shell_id -re ".*ermit.*>.*$" { }
-i $shell_id timeout {
- perror "Response failed from kermit."
+ perror "Response failed from Kermit."
return -1
}
}
expect {
-i $shell_id -re ".*other options.\[\r\n\]+" { }
-i $shell_id timeout {
- perror "Unable to resume kermit connection."
+ perror "Unable to resume Kermit connection."
return -1
}
}
return 0
}
-
-#
# Send STRING to DEST.
#
-proc kermit_send { dest string args } {
+proc kermit_send {dest string args} {
if [board_info $dest exists transmit_pause] {
set f [open "/tmp/fff" "w"]
puts -nonewline $f "$string"
}
}
+# Transmit FILE directly to DEST as raw data.
+# No translation is performed.
#
-# Transmit FILE directly to DEST as raw data. No translation is
-# performed.
-#
-proc kermit_transmit { dest file args } {
+proc kermit_transmit {dest file args} {
if [board_info $dest exists transmit_pause] {
kermit_command $dest "transmit $file"
return ""