Created
October 16, 2019 03:41
-
-
Save adeonhy/ca2dc2713de07e936c2e72ee8e473e4b 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 | |
printf "Detecting USB port, reset your controller now." | |
ls /dev/tty* > /tmp/1 | |
while [ -z $USB ]; do | |
sleep 0.5 | |
printf "." | |
ls /dev/tty* > /tmp/2 | |
USB=`comm -13 /tmp/1 /tmp/2 | grep -o '/dev/tty.*'` | |
mv /tmp/2 /tmp/1 | |
done | |
echo "" | |
echo "Device $USB has appeared; assuming it is the controller." | |
printf "Waiting for $USB to become writable." | |
while [ ! -w "$USB" ]; do | |
sleep 0.5; printf "."; | |
done; | |
echo "" | |
avrdude -p atmega32u4 -c avr109 -P $USB -U flash:w:$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment