From e7141291a58da23de4ec455f7e7a7cb0c5d1df75 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 25 Sep 2012 19:50:35 +0200 Subject: [PATCH] Workaround for spurious port opening after upload (Arduino Due) --- hardware/arduino/sam/cores/arduino/USB/CDC.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hardware/arduino/sam/cores/arduino/USB/CDC.cpp b/hardware/arduino/sam/cores/arduino/USB/CDC.cpp index 40714c9ab..615d2a2c3 100644 --- a/hardware/arduino/sam/cores/arduino/USB/CDC.cpp +++ b/hardware/arduino/sam/cores/arduino/USB/CDC.cpp @@ -252,6 +252,10 @@ size_t Serial_::write(uint8_t c) { // where the port is configured (lineState != 0) but not quite opened. Serial_::operator bool() { + // this is here to avoid spurious opening after upload + if (millis() < 500) + return false; + bool result = false; if (_usbLineInfo.lineState > 0)