feat: first working version

This commit is contained in:
2025-07-26 17:48:46 -04:00
parent 5200177db9
commit 32c88f6dcb

View File

@@ -2,14 +2,47 @@
set timeout 100
exp_internal 1
set send_slow {1 0.005}
#
# A procedure to send a string character by character,
# waiting for each character to be echoed before sending the next.
#
proc reliable_send {str} {
# Set a timeout for waiting for the echo of a single character
set timeout 2
# Loop through each character of the input string
for {set i 0} {$i < [string length $str]} {incr i} {
set char [string index $str $i]
# Send the single character.
# The "--" argument ensures that if the character is a dash,
# it isn't interpreted as an option to the send command.
send -- $char
# Expect the character to be echoed back
expect {
# If the echo is received, continue to the next iteration
-ex $char {
# Optional: uncomment the next line for debugging
# puts "Sent and received: $char"
continue
}
# If we time out waiting for the echo, handle the error
timeout {
puts "ERROR: Timed out waiting for echo of character: '$char'"
exit 1
}
}
}
}
spawn picocom -b 115200 /dev/ttyUSB1 --logfile $env(OUTPUT_LOG_FILE)
set term_id $spawn_id
spawn ./toggle_jg928a_port.sh
set spawn_id $term_id
#spawn ssh root@jg928a
expect "DRAM"
send " "
@@ -33,12 +66,11 @@ expect {
expect {
"Please press Enter to activate this console." {
send -s "\n"
sleep 50
send -s {
sysupgrade https://downloads.openwrt.org/releases/23.05.2/targets/mpc85xx/p1020/openwrt-23.05.2-mpc85xx-p1020-extreme-networks_ws-ap3825i-squashfs-sysupgrade.bin;
done;
}
send "\n"
sleep 5
reliable_send {while true; do sysupgrade https://downloads.openwrt.org/releases/23.05.2/targets/mpc85xx/p1020/openwrt-23.05.2-mpc85xx-p1020-extreme-networks_ws-ap3825i-squashfs-sysupgrade.bin; done
}
}
}
expect {Sending KILL to remaining processes}