stmhal: Add autoflash script, to flash a DFU device automatically.

This commit is contained in:
Damien George 2014-03-17 13:04:51 +00:00
parent fb431bf556
commit 8a9a31e57b
1 changed files with 24 additions and 0 deletions

24
stmhal/autoflash Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
#
# this script waits for a DFU device to be attached and then flashes it
# it then waits until the DFU mode is exited, and then loops
while true; do
echo "waiting for DFU device..."
while true; do
if lsusb | grep -q DFU; then
break
fi
sleep 1s
done
echo "found DFU device, flashing"
dfu-util -a 0 -D build/flash.dfu
echo "waiting for DFU to exit..."
while true; do
if lsusb | grep -q DFU; then
sleep 1s
continue
fi
break
done
done