summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/autoflash
blob: 0f4bfd0394afb73a3d8e1c1143eeae6ab2d81d08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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