Only search through newly detected devices and discard ones that disappeared

This commit is contained in:
Danny Nguyen 2018-01-25 16:36:01 -05:00 committed by Jack Humbert
parent 53ff8a31b6
commit 361810dca8
1 changed files with 3 additions and 2 deletions

View File

@ -175,10 +175,11 @@ avrdude: $(BUILD_DIR)/$(TARGET).hex check-size
ls /dev/tty* > /tmp/1; \
echo -e "Detecting USB port, reset your controller now.\c"; \
while [ -z $$USB ]; do \
sleep 1; \
echo -e ".\c"; \
sleep 0.5; \
ls /dev/tty* > /tmp/2; \
USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
USB=`comm -13 /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
mv /tmp/2 /tmp/1; \
done; \
echo ""; \
echo "Detected controller on USB port at $$USB"; \