Skip to content

Commit 68f6184

Browse files
committed
reliable method to get iSerial field
1 parent e6efb60 commit 68f6184

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

arduino-core/src/cc/arduino/packages/uploaders/SerialUploader.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import cc.arduino.LoadVIDPIDSpecificPreferences;
3838
import cc.arduino.packages.Uploader;
3939
import processing.app.*;
40+
import cc.arduino.packages.BoardPort;
4041
import processing.app.debug.RunnerException;
4142
import processing.app.debug.TargetPlatform;
4243
import processing.app.helpers.OSUtils;
@@ -152,6 +153,11 @@ public boolean uploadUsingPreferences(File sourcePath, String buildPath, String
152153
}
153154
}
154155

156+
BoardPort boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port"));
157+
if (boardPort.getPrefs().get("iserial") != null) {
158+
prefs.put("serial.port.iserial", boardPort.getPrefs().get("iserial"));
159+
}
160+
155161
prefs.put("build.path", buildPath);
156162
prefs.put("build.project_name", className);
157163
if (verbose) {

arduino-core/src/processing/app/Platform.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ protected Map<String, Object> resolveDeviceByVendorIdProductId(Map<String, Targe
166166
boardData.put("board", board);
167167
boardData.put("vid", vids.get(i));
168168
boardData.put("pid", pids.get(i));
169-
boardData.put("iserial", readVIDPID.substring(vidPid.length()));
169+
boardData.put("iserial", readVIDPID.substring(vidPid.length()+1));
170170
return boardData;
171171
}
172172
}

0 commit comments

Comments
 (0)