From c616ae62709895e7dcd5c9fbaee2b2d7900f29ba Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Mon, 13 Dec 2021 18:19:21 -0500 Subject: [PATCH] download_and_test: put the pluto into dfu mode, download & boot it. this reboots the pluto into dfu-mode, downloads the files, and then boots the new image. Something when you are testing new images - you end up doing alot. Enough times that I think I saved time by developing the script. Signed-off-by: Robin Getz --- download_and_test.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 download_and_test.sh diff --git a/download_and_test.sh b/download_and_test.sh new file mode 100755 index 00000000..4cd279cf --- /dev/null +++ b/download_and_test.sh @@ -0,0 +1,35 @@ +#~/bin/sh +# This resets a connected pluto, loads firmware into ram, and boots it +# + +#default IP address +ipaddr=192.168.2.1 + +if [ ! -f ./build/pluto.dfu ] ; then + echo no file to upload + exit +fi + +ssh_cmd() +{ + sshpass -v -panalog ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null -oCheckHostIP=no root@${ipaddr} "$1" 2>/dev/null + if [ "$?" -ne "0" ] ; then + echo ssh command $1 failed + exit + fi +} +ssh_cmd "device_reboot ram" + +lines=0 +attempt=0 +while [ "${lines}" -le "8" -a "${attempt}" -le "10" ] +do + lines=$(sudo dfu-util -l -d 0456:b673,0456:b674 | wc -l) + if [ "${lines}" -le "8" ] ; then + sleep 1 + fi + ((attempt++)) +done + +# -R resets/terminates the dfu after we are done +sudo dfu-util -R -d 0456:b673,0456:b674 -D ./build/pluto.dfu -a firmware.dfu