diff options
author | Bernhard Tittelbach <bernhard@tittelbach.org> | 2016-06-12 05:06:11 +0200 |
---|---|---|
committer | Bernhard Tittelbach <bernhard@tittelbach.org> | 2016-06-12 06:36:54 +0200 |
commit | c35b4171d0cd2b370262ae2bb772f627b1f6d7b9 (patch) | |
tree | 5c7cf01c594791c5321d7bb3c4f7de1d6b9816c4 /tools/reset_sparkfun | |
parent | Revert "bmp180 pressure sensor, just lacks arduino i2c-wire-lib and testing" (diff) |
ArduinoProMicro
Diffstat (limited to 'tools/reset_sparkfun')
-rwxr-xr-x | tools/reset_sparkfun | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/reset_sparkfun b/tools/reset_sparkfun new file mode 100755 index 0000000..fd3cd05 --- /dev/null +++ b/tools/reset_sparkfun @@ -0,0 +1,40 @@ +#!/bin/sh +#(c) Bernhard Tittelbach + +if [ -z "$1" ]; then + IDS="03eb:204b" +else + IDS=$1 +fi + +WAIT_MAX=20 + +FOUND=0 +DISAPPEARED=0 +echo -n "Please double-tap GND to the RST pin" +i=$WAIT_MAX +while (test $i -gt 0); do + echo -n "." + for id in $IDS; do + lsusb -d $id > /dev/null 2>&1 + if [ $? -eq 0 ]; then + FOUND=1 + [[ $DISAPPEARED -eq 1 ]] && break; + else + [[ $FOUND -eq 1 ]] && DISAPPEARED=1; + fi + done + if [ $FOUND -eq 1 -a $DISAPPEARED -eq 1 ]; then + break; + fi + sleep 1 + i=$(($i-1)) +done + +if [ $FOUND -eq 1 ]; then + echo " device found!" +else + echo " timout - trying anyway" +fi + +exit 0 |