You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
859 B
45 lines
859 B
11 years ago
|
#!/bin/sh
|
||
|
#
|
||
11 years ago
|
# 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/ttyACM0
|
||
11 years ago
|
DEVICE=0483:df11
|
||
11 years ago
|
|
||
|
while true; do
|
||
|
echo "waiting for DFU device..."
|
||
|
while true; do
|
||
|
if lsusb | grep -q DFU; then
|
||
|
break
|
||
|
fi
|
||
|
sleep 1s
|
||
|
done
|
||
11 years ago
|
|
||
11 years ago
|
echo "found DFU device, flashing"
|
||
11 years ago
|
dfu-util -a 0 -d $DEVICE -D build/flash.dfu
|
||
11 years ago
|
|
||
11 years ago
|
echo "waiting for DFU to exit..."
|
||
|
while true; do
|
||
|
if lsusb | grep -q DFU; then
|
||
|
sleep 1s
|
||
|
continue
|
||
|
fi
|
||
|
break
|
||
|
done
|
||
11 years ago
|
|
||
|
echo "waiting for $SERIAL..."
|
||
|
while true; do
|
||
|
if ls /dev/tty* | grep -q $SERIAL; then
|
||
|
break
|
||
|
fi
|
||
|
sleep 1s
|
||
|
continue
|
||
|
done
|
||
|
sleep 1s
|
||
|
picocom $SERIAL
|
||
11 years ago
|
done
|