Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
// it happened within 250 ms. So we wait until the reset should
// have already occured before we start scanning.
actualUploadPort = waitForUploadPort(userSelectedUploadPort, before);

// 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,
// apply to other platforms as well.
Thread.sleep(250);
}
} catch (SerialException e) {
throw new RunnerException(e);
Expand Down Expand Up @@ -247,11 +252,10 @@ private String waitForUploadPort(String uploadPort, List<String> before) throws
Thread.sleep(250);
elapsed += 250;

// On Windows, it can take a long time for the port to disappear and
// come back, so use a longer time out before assuming that the
// selected
// port is the bootloader (not the sketch).
if (((!OSUtils.isWindows() && elapsed >= 500) || elapsed >= 5000) && now.contains(uploadPort)) {
// On Windows and OS X, it can take a few seconds for the port to disappear and
// come back, so use a time out before assuming that the selected port is the
// bootloader (not the sketch).
if (elapsed >= 5000 && now.contains(uploadPort)) {
if (verbose)
System.out.println("Uploading using selected port: " + uploadPort);
return uploadPort;
Expand Down