1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-13 10:29:35 +01:00

Merge pull request #4515 from sandeepmistry/wait-for-upload-port-timeout-bump

Increase wait for upload port timeout to 5s on all platforms
This commit is contained in:
Martino Facchin 2016-04-01 11:15:57 +02:00
commit 629509f302

View File

@ -136,6 +136,11 @@ 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);
// 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);
@ -247,11 +252,10 @@ public class SerialUploader extends Uploader {
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;