From 7a535d9c40e3b58c6ed2fb3babd598df9ec92838 Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Mon, 29 Feb 2016 13:01:11 -0500 Subject: [PATCH] Add OS X specific delay after waiting for upload port, to prevent "Resource busy" errors on open --- .../src/cc/arduino/packages/uploaders/SerialUploader.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java index 4ad990fa9..30f6fbdf3 100644 --- a/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java +++ b/arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java @@ -136,6 +136,12 @@ public class SerialUploader extends Uploader { // it happened within 250 ms. So we wait until the reset should // have already occured before we start scanning. actualUploadPort = waitForUploadPort(userSelectedUploadPort, before); + + if (OSUtils.isMacOS()) { + // on OS X, if the port is opened too quickly after it is detected, + // a "Resource busy" error occurs, add a delay to workaround this + Thread.sleep(250); + } } } catch (SerialException e) { throw new RunnerException(e);