Skip to content

Commit

Permalink
Sleep until USB port becomes writable before running avrdude (qmk#5393)
Browse files Browse the repository at this point in the history
* sleep until usb port becomes writable before running avrdude

* only wait for a writable USB port when not on MSYS

using MINGW or MSYS: sleep for one second, as before.

otherwise: wait for the port to become writable.

* typo

* typo
  • Loading branch information
datagrok authored and drashna committed Mar 13, 2019
1 parent 5a12b05 commit f34244a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tmk_core/avr.mk
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ define EXEC_AVRDUDE
mv /tmp/2 /tmp/1; \
done; \
echo ""; \
echo "Detected controller on USB port at $$USB"; \
echo "Device $$USB has appeared; assuming it is the controller."; \
if $(GREP) -q -s 'MINGW\|MSYS' /proc/version; then \
USB=`echo "$$USB" | perl -pne 's/\/dev\/ttyS(\d+)/COM.($$1+1)/e'`; \
echo "Remapped MSYS2 USB port to $$USB"; \
sleep 1; \
else \
printf "Waiting for $$USB to become writable."; \
while [ ! -w "$$USB" ]; do sleep 0.5; printf "."; done; echo ""; \
fi; \
sleep 1; \
avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
fi
endef
Expand Down

0 comments on commit f34244a

Please sign in to comment.