File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22#
3- # this script waits for a DFU device to be attached and then flashes it
4- # it then waits until the DFU mode is exited, and then loops
3+ # This script loops doing the following:
4+ # - wait for DFU device
5+ # - flash DFU device
6+ # - wait for DFU to exit
7+ # - wait for serial port to appear
8+ # - run a terminal
9+
10+ SERIAL=/dev/ttyACM0
511
612while true ; do
713 echo " waiting for DFU device..."
@@ -11,8 +17,10 @@ while true; do
1117 fi
1218 sleep 1s
1319 done
20+
1421 echo " found DFU device, flashing"
1522 dfu-util -a 0 -D build/flash.dfu
23+
1624 echo " waiting for DFU to exit..."
1725 while true ; do
1826 if lsusb | grep -q DFU; then
@@ -21,4 +29,15 @@ while true; do
2129 fi
2230 break
2331 done
32+
33+ echo " waiting for $SERIAL ..."
34+ while true ; do
35+ if ls /dev/tty* | grep -q $SERIAL ; then
36+ break
37+ fi
38+ sleep 1s
39+ continue
40+ done
41+ sleep 1s
42+ picocom $SERIAL
2443done
You can’t perform that action at this time.
0 commit comments