期待脚本不发送命令

问题描述 投票:0回答:1

我正在使用期望处理嵌入式系统的U-boot。但是,我的脚本在某些时候没有发送命令。这是我的剧本

#!/usr/bin/expect
set scriptaddr "0x32000000"

spawn screen /dev/ttyUSB1 115200
expect "Hit any key to stop autoboot:"
send "\r"
puts "Start flashing"
send "tftp $scriptaddr recovery_files/install.scr \r"
sleep 2
send "source 0x32000000\r"
## here start the flashing process which takes 15 mins

## this is the part where not working ##
expect "(Please reset your board)"
sleep 3
send "reset\r"

这是在控制台上显示的最后一部分,等待用户键入“重置”

         #################################################################
         #################################################################
         ###
         2 MiB/s
done
Bytes transferred = 7333121 (6fe501 hex)
Uncompressed size: 168820224 = 0xA0FFE00

MMC write: dev # 0, block # 3940352, count 329727 ... 329727 blocks written: OK

============ INSTALLATION IS DONE =============
(Please reset your board)
machine#

我犯了什么错误?请帮忙,谢谢!

expect u-boot
1个回答
1
投票

默认情况下,expect会有10秒的超时时间。解决方案:set timeout <time in second>

© www.soinside.com 2019 - 2024. All rights reserved.