Created
September 6, 2018 10:18
-
-
Save thinkl33t/b5f01e92335f56dd4918c4c36181a5c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# This script loops doing the following: | |
# - wait for DFU device | |
# - flash DFU device | |
# - wait for DFU to exit | |
# - wait for serial port to appear | |
# - run a terminal | |
SERIAL=/dev/ttyACM1 | |
DEVICE=1cbe:00ff | |
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 $DEVICE -D mpex_with_boot.dfu | |
echo "waiting for DFU to exit..." | |
while true; do | |
if lsusb | grep -q DFU; then | |
sleep 1s | |
continue | |
fi | |
break | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment