aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Patuzzo <chris@patuzzo.co.uk>2014-05-03 01:36:42 +0100
committerSudar <sudar@sudarmuthu.com>2014-05-03 09:01:24 +0530
commit70dfdcc7eb6a4a820533c2c0f58203f4f4ae6da4 (patch)
treebad35612f90edae1ea9627b0b68143ad0a70a9de
parent22e876e88bf2490322c5cc4f291e7deb527d1c9a (diff)
If no port is specified, try to guess it from wildcards
Fix #197
-rw-r--r--Arduino.mk8
-rw-r--r--HISTORY.md1
2 files changed, 8 insertions, 1 deletions
diff --git a/Arduino.mk b/Arduino.mk
index e31bee7..a352628 100644
--- a/Arduino.mk
+++ b/Arduino.mk
@@ -866,8 +866,14 @@ ifeq ($(CURRENT_OS), WINDOWS)
COM_PORT_ID = $(subst com,,$(MONITOR_PORT))
COM_STYLE_MONITOR_PORT = com$(COM_PORT_ID)
DEVICE_PATH = /dev/ttyS$(shell awk 'BEGIN{ print $(COM_PORT_ID) - 1 }')
-else
+endif
+
+ifdef ARDUINO_PORT
DEVICE_PATH = $(MONITOR_PORT)
+else
+ # If no port is specified, try to guess it from wildcards.
+ DEVICE_PATH = $(firstword $(wildcard \
+ /dev/ttyACM? /dev/ttyUSB? /dev/tty.usbserial* /dev/tty.usbmodem*))
endif
# Returns the Arduino port (first wildcard expansion) if it exists, otherwise it errors.
diff --git a/HISTORY.md b/HISTORY.md
index 9300c72..d20f7da 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -7,6 +7,7 @@ I tried to give credit whenever possible. If I have missed anyone, kindly add it
### 1.3.4 (In development)
- Tweak: Allow spaces in "Serial.begin (....)". (Issue #190) (https://github.com/pdav)
- Add: Add support for compiling assembler code. (Issue #195) (https://github.com/hrobeers)
+- Add: Try to guess port from wildcards if not specified. (Issue #197) (https://github.com/tuzz)
### 1.3.3 (2014-04-12)
- Fix: Make a new manpage for ard-reset-arduino. Fixes issue #188 (https://github.com/sej7278)