|
|
|
@ -17,14 +17,13 @@ |
|
|
|
# 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 |
|
|
|
|
|
|
|
@ -46,8 +45,8 @@ proc kermit_open { dest args } { |
|
|
|
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 |
|
|
|
} |
|
|
|
|
|
|
|
@ -64,7 +63,7 @@ proc kermit_open { dest args } { |
|
|
|
warning "Never got prompt from Kermit." |
|
|
|
set result -1 |
|
|
|
incr tries |
|
|
|
if { $tries <= 2 } { |
|
|
|
if {$tries <= 2} { |
|
|
|
exp_continue |
|
|
|
} |
|
|
|
} |
|
|
|
@ -74,7 +73,7 @@ proc kermit_open { dest args } { |
|
|
|
perror "Never connected." |
|
|
|
set result -1 |
|
|
|
incr tries |
|
|
|
if { $tries <= 2 } { |
|
|
|
if {$tries <= 2} { |
|
|
|
exp_continue |
|
|
|
} |
|
|
|
} |
|
|
|
@ -82,13 +81,13 @@ proc kermit_open { dest args } { |
|
|
|
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) |
|
|
|
@ -105,23 +104,23 @@ proc kermit_open { dest args } { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# |
|
|
|
# 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 "c" |
|
|
|
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." |
|
|
|
} |
|
|
|
} |
|
|
|
@ -133,7 +132,7 @@ proc kermit_command { dest args } { |
|
|
|
expect { |
|
|
|
-i $shell_id -re ".*ermit.*>.*$" { } |
|
|
|
-i $shell_id timeout { |
|
|
|
perror "Response failed from kermit." |
|
|
|
perror "Response failed from Kermit." |
|
|
|
return -1 |
|
|
|
} |
|
|
|
} |
|
|
|
@ -142,18 +141,16 @@ proc kermit_command { dest args } { |
|
|
|
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" |
|
|
|
@ -166,11 +163,10 @@ proc kermit_send { dest string args } { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# 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 "" |
|
|
|
|