/[dejagnu]/dejagnu/lib/kermit.exp
ViewVC logotype

Diff of /dejagnu/lib/kermit.exp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by rsavoye, Mon Mar 17 02:25:07 2003 UTC revision 1.5 by bje, Thu Aug 7 03:42:43 2003 UTC
# Line 29  proc kermit_open { dest args } { Line 29  proc kermit_open { dest args } {
29      global board_info      global board_info
30    
31      if [board_info $dest exists name] {      if [board_info $dest exists name] {
32          set dest [board_info $dest name];          set dest [board_info $dest name]
33      }      }
34      if [board_info ${dest} exists serial] {      if [board_info ${dest} exists serial] {
35          set port [board_info ${dest} serial];          set port [board_info ${dest} serial]
36          set device "-l [board_info ${dest} serial]"          set device "-l [board_info ${dest} serial]"
37          if [board_info ${dest} exists baud] {          if [board_info ${dest} exists baud] {
38              append device " -b [board_info ${dest} baud]"              append device " -b [board_info ${dest} baud]"
39          }          }
40      } else {      } else {
41          set port [board_info ${dest} netport];          set port [board_info ${dest} netport]
42          set device "-j [board_info ${dest} netport]";          set device "-j [board_info ${dest} netport]"
43      }      }
44    
45      set tries 0      set tries 0
# Line 91  proc kermit_open { dest args } { Line 91  proc kermit_open { dest args } {
91      if { $result < 0 } {      if { $result < 0 } {
92          perror "Couldn't connect after $tries tries."          perror "Couldn't connect after $tries tries."
93          if [info exists board_info($dest,fileid)] {          if [info exists board_info($dest,fileid)] {
94              unset board_info($dest,fileid);              unset board_info($dest,fileid)
95          }          }
96          return -1          return -1
97      } else {      } else {
# Line 110  proc kermit_open { dest args } { Line 110  proc kermit_open { dest args } {
110  #  #
111  proc kermit_command { dest args } {  proc kermit_command { dest args } {
112      if [board_info $dest exists name] {      if [board_info $dest exists name] {
113          set dest [board_info $dest name];          set dest [board_info $dest name]
114      }      }
115      set shell_id [board_info $dest fileid];      set shell_id [board_info $dest fileid]
116      # Sometimes we have to send multiple ^\c sequences. Don't know      # Sometimes we have to send multiple ^\c sequences. Don't know
117      # why.      # why.
118      set timeout 2;      set timeout 2
119      for { set i 1; } {$i<=5} {incr i} {      for { set i 1; } {$i<=5} {incr i} {
120          send -i $shell_id "c";          send -i $shell_id "c"
121          expect {          expect {
122              -i $shell_id -re ".*Back at.*ermit.*>.*$" { set i 10;}              -i $shell_id -re ".*Back at.*ermit.*>.*$" { set i 10;}
123              -i $shell_id timeout {              -i $shell_id timeout {
124                  if { $i > 2 } {                  if { $i > 2 } {
125                      warning "Unable to get prompt from kermit.";                      warning "Unable to get prompt from kermit."
126                  }                  }
127              }              }
128          }          }
129      }      }
130      foreach command $args {      foreach command $args {
131          set timeout 120          set timeout 120
132          send -i $shell_id "${command}\r";          send -i $shell_id "${command}\r"
133          expect {          expect {
134              -i $shell_id -re ".*ermit.*>.*$" { }              -i $shell_id -re ".*ermit.*>.*$" { }
135              -i $shell_id timeout {              -i $shell_id timeout {
136                  perror "Response failed from kermit.";                  perror "Response failed from kermit."
137                  return -1;                  return -1
138              }              }
139          }          }
140      }      }
141      send -i $shell_id "c\r";      send -i $shell_id "c\r"
142      expect {      expect {
143          -i $shell_id -re ".*other options.\[\r\n\]+" { }          -i $shell_id -re ".*other options.\[\r\n\]+" { }
144          -i $shell_id timeout {          -i $shell_id timeout {
145              perror "Unable to resume kermit connection.";              perror "Unable to resume kermit connection."
146              return -1;              return -1
147          }          }
148      }      }
149      return 0;      return 0
150  }  }
151    
152    
# Line 155  proc kermit_command { dest args } { Line 155  proc kermit_command { dest args } {
155  #  #
156  proc kermit_send { dest string args } {  proc kermit_send { dest string args } {
157      if [board_info $dest exists transmit_pause] {      if [board_info $dest exists transmit_pause] {
158          set f [open "/tmp/fff" "w"];          set f [open "/tmp/fff" "w"]
159          puts -nonewline $f "$string";          puts -nonewline $f "$string"
160          close $f;          close $f
161          set result [remote_transmit $dest /tmp/fff];          set result [remote_transmit $dest /tmp/fff]
162          remote_file build delete "/tmp/fff";          remote_file build delete "/tmp/fff"
163          return "$result";          return "$result"
164      } else {      } else {
165          return [standard_send $dest $string];          return [standard_send $dest $string]
166      }      }
167  }  }
168    
# Line 172  proc kermit_send { dest string args } { Line 172  proc kermit_send { dest string args } {
172  #  #
173  proc kermit_transmit { dest file args } {  proc kermit_transmit { dest file args } {
174      if [board_info $dest exists transmit_pause] {      if [board_info $dest exists transmit_pause] {
175          kermit_command $dest "transmit $file";          kermit_command $dest "transmit $file"
176          return "";          return ""
177      } else {      } else {
178          return [standard_transmit $dest $file];          return [standard_transmit $dest $file]
179      }      }
180  }  }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26