aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon John <git@the-jedi.co.uk>2013-06-13 14:55:40 +0200
committerSudar <sudar@sudarmuthu.com>2013-06-13 21:02:00 +0530
commit4118af0c426f0a7270f3579fc6897089fa60b1dd (patch)
tree262c468ba894af6e221564b5657f633323a5bc75
parentd8c357f6d6f5c15f887c8c3b5400790c71abf702 (diff)
Make serial baudrate detection work in Mac
Replace regex used for detecting serial baudrate. New regex is tested in both debian and mountain lion. fix #52 - serial monitor baudrate detection
-rw-r--r--HISTORY.md1
-rw-r--r--arduino-mk/Arduino.mk4
2 files changed, 2 insertions, 3 deletions
diff --git a/HISTORY.md b/HISTORY.md
index e582bdf..52b9185 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -6,6 +6,7 @@ The following is the rough list of changes that went into different versions. I
### 0.10.6 (in development)
- Fix whitespace and add /dev/null redirection (https://github.com/sej7278)
- Change the way AUTO_ARDUINO_VERSION is computed (https://github.com/sej7278)
+- Make serial monitor baudrate detection work in Mac as well(https://github.com/sej7278)
### 0.10.5 (2013-06-11)
- Add USB_VID and USB_PID to CPPFLAGS only if the board is Leonardo.
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index efa3bd6..a9deebe 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -559,9 +559,7 @@ endif
# for more information (search for 'character special device').
#
ifndef MONITOR_BAUDRATE
- # This works only in linux. TODO: Port it to MAC OS also
- # https://github.com/sudar/Arduino-Makefile/issues/52
- SPEED = $(shell grep --max-count=1 --regexp="Serial.begin" $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS) | sed -e 's/\t//g' -e 's/\/\/.*$$//g' -e 's/(/\t/' -e 's/)/\t/' | awk -F '\t' '{print $$2}' )
+ SPEED = $(shell egrep -h 'Serial.begin\([0-9]+\)' $(LOCAL_PDE_SRCS) $(LOCAL_INO_SRCS) | sed -e 's/[^0-9]//g'| head -n1)
MONITOR_BAUDRATE = $(findstring $(SPEED),300 1200 2400 4800 9600 14400 19200 28800 38400 57600 115200)
ifeq ($(MONITOR_BAUDRATE),)