liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

boot.expect (933B)


      1 # This is for use with minicom, but needs you to configure it to
      2 # use expect as its "Script program" instead of runscript.  Try
      3 # Ctrl+A O -> Filenames and paths -> D
      4 
      5 fconfigure stderr -buffering  none
      6 fconfigure stdout -buffering  none
      7 
      8 proc waitprompt { } {
      9     expect {
     10       "BusyBox" { puts stderr  "DONE\r"; exit 0 }
     11       "READY" { puts stderr ";;; READY\r"; }
     12       timeout { puts stderr ";;; timed out waiting after $line\r" }
     13     }
     14 }
     15 
     16 proc sendline { line } {
     17      send "$line; echo \$ready \r"
     18      sleep 0.1
     19 }
     20 
     21 log_user 0
     22 log_file -a -open stderr
     23 
     24 set f [open "result/boot.scr"]
     25 
     26 send "setenv ready REA\r"
     27 sleep 0.1
     28 send "setenv ready \${ready}DY\r"
     29 sleep 0.1
     30 
     31 set timeout 300
     32 expect_before timeout abort
     33 while {[gets $f line] >= 0} {
     34     puts stderr ";;; next line $line\r"
     35     puts stderr ";;; waiting for prompt\r"
     36     puts stderr ";;; sending\r"	
     37     sendline $line
     38     waitprompt
     39 }
     40 
     41 puts stderr "done\r\n"
     42 close $f