aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudar <sudar@sudarmuthu.com>2013-07-02 08:41:19 +0530
committerSudar <sudar@sudarmuthu.com>2013-07-02 21:48:33 +0530
commit5abf12bdb2fa131e840d89a09fd11e8da0e2f433 (patch)
tree57bf716b5c76496ce5fd81a82f042b2a8325341f
parent8a2e251e95205c6501932bf167fc763b1a5b574c (diff)
Move wait-for-reconnection logic inside ard-reset-arduino
When a Leonardo based board is reset, the port disappears and we need to wait till it comes back. Earlier this logic was handled by a separate shell script. Now the logic is moved inside the ard-reset-arduino perl script. This is done to reduce the number of binaries that are needed by the makefile. Fix #95
-rw-r--r--HISTORY.md1
-rw-r--r--arduino-mk/Arduino.mk10
-rwxr-xr-xbin/ard-reset-arduino13
-rwxr-xr-xbin/wait-connection-leonardo15
4 files changed, 13 insertions, 26 deletions
diff --git a/HISTORY.md b/HISTORY.md
index 0d79497..a373b71 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -12,6 +12,7 @@ The following is the rough list of changes that went into different versions. I
- Remove redundant checks for ARDUINO_DIR
- Improve avrdude and avrdude.conf path auto detection. Fix issue #48
- Move binary sketch size verification logic inside makefile. Fix issue #54
+- Remove dependency on wait-connection-leonardo shell script. Fix issue #95
### 0.12.0 (2013-06-20)
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)
diff --git a/arduino-mk/Arduino.mk b/arduino-mk/Arduino.mk
index 12ad2f6..2fb9e3e 100644
--- a/arduino-mk/Arduino.mk
+++ b/arduino-mk/Arduino.mk
@@ -468,15 +468,6 @@ ifndef RESET_CMD
endif
endif
-ifndef WAIT_CONNECTION_CMD
- ifdef LEO_RESET
- WAIT_CONNECTION_CMD = \
- $(ARDMK_PATH)/wait-connection-leonardo $(call get_arduino_port)
- else
- WAIT_CONNECTION_CMD =
- endif
-endif
-
ifeq ($(BOARD_TAG),leonardo)
ERROR_ON_LEONARDO = $(error On leonardo, raw_xxx operation is not supported)
else
@@ -1024,7 +1015,6 @@ raw_eeprom: $(TARGET_HEX) verify_size
reset:
$(call arduino_output,Resetting Arduino...)
$(RESET_CMD)
- $(WAIT_CONNECTION_CMD)
# stty on MacOS likes -F, but on Debian it likes -f redirecting
# stdin/out appears to work but generates a spurious error on MacOS at
diff --git a/bin/ard-reset-arduino b/bin/ard-reset-arduino
index 6269878..de5cf93 100755
--- a/bin/ard-reset-arduino
+++ b/bin/ard-reset-arduino
@@ -39,7 +39,18 @@ foreach my $dev (@ARGV)
$p->write_settings;
$p->close;
- print STDERR "Switching to 1200 baud on $dev\n"
+ print STDERR "Forcing reset using 1200bps open/close on port $dev\n"
+ if $Opt{verbose};
+
+ # wait for it to come back
+ sleep 1;
+ while( ! -e $dev ) {
+ print STDERR "Waiting for $dev to come back\n"
+ if $Opt{verbose};
+ sleep 1;
+ }
+
+ print STDERR "$dev has come back after reset\n"
if $Opt{verbose};
}
else
diff --git a/bin/wait-connection-leonardo b/bin/wait-connection-leonardo
deleted file mode 100755
index 6a594d2..0000000
--- a/bin/wait-connection-leonardo
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-while [ ! -e $1 ]
-do
- echo Waiting connection at $1
- sleep 0.2
-done
-
-sleep 1
-# necessary for me...
-# /dev/ttyACM0 used to disappear after the reset
-# but no longer now. How can I tell whether the
-# connection is ready?
-
-echo Connection Established