- ls /dev/tty* > /tmp/1; \
- echo "Detecting Pro Micro port, reset your Pro Micro now.\c"; \
- while [ -z $$USB ]; do \
- sleep 1; \
- echo ".\c"; \
- ls /dev/tty* > /tmp/2; \
- USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
- done; \
- echo ""; \
- echo "Detected Pro Micro port at $$USB"; \
- sleep 1; \
- avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex
+ if grep -q -s Microsoft /proc/version; then \
+ echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \
+ else \
+ ls /dev/tty* > /tmp/1; \
+ echo "Detecting USB port, reset your controller now.\c"; \
+ while [ -z $$USB ]; do \
+ sleep 1; \
+ echo ".\c"; \
+ ls /dev/tty* > /tmp/2; \
+ USB=`diff /tmp/1 /tmp/2 | grep -o '/dev/tty.*'`; \
+ done; \
+ echo ""; \
+ echo "Detected controller on USB port at $$USB"; \
+ sleep 1; \
+ avrdude -p $(MCU) -c avr109 -P $$USB -U flash:w:$(BUILD_DIR)/$(TARGET).hex; \
+ fi