mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Add iSerial to reported VID_PID string
serial.port.iserial holds the iSerial value
This commit is contained in:
parent
00ba7aa68c
commit
3c16ac025a
@ -86,6 +86,7 @@ public class SerialBoardsLister extends TimerTask {
|
||||
if (boardData != null) {
|
||||
boardPort.getPrefs().put("vid", boardData.get("vid").toString());
|
||||
boardPort.getPrefs().put("pid", boardData.get("pid").toString());
|
||||
boardPort.getPrefs().put("iserial", boardData.get("iserial").toString());
|
||||
|
||||
TargetBoard board = (TargetBoard) boardData.get("board");
|
||||
if (board != null) {
|
||||
|
@ -37,6 +37,7 @@ package cc.arduino.packages.uploaders;
|
||||
import cc.arduino.LoadVIDPIDSpecificPreferences;
|
||||
import cc.arduino.packages.Uploader;
|
||||
import processing.app.*;
|
||||
import cc.arduino.packages.BoardPort;
|
||||
import processing.app.debug.RunnerException;
|
||||
import processing.app.debug.TargetPlatform;
|
||||
import processing.app.helpers.OSUtils;
|
||||
@ -152,6 +153,11 @@ public class SerialUploader extends Uploader {
|
||||
}
|
||||
}
|
||||
|
||||
BoardPort boardPort = BaseNoGui.getDiscoveryManager().find(PreferencesData.get("serial.port"));
|
||||
if (boardPort.getPrefs().get("iserial") != null) {
|
||||
prefs.put("serial.port.iserial", boardPort.getPrefs().get("iserial"));
|
||||
}
|
||||
|
||||
prefs.put("build.path", buildPath);
|
||||
prefs.put("build.project_name", className);
|
||||
if (verbose) {
|
||||
|
@ -161,11 +161,12 @@ public class Platform {
|
||||
List<String> pids = new LinkedList<String>(board.getPreferences().subTree("pid", 1).values());
|
||||
for (int i = 0; i < vids.size(); i++) {
|
||||
String vidPid = vids.get(i) + "_" + pids.get(i);
|
||||
if (vidPid.toUpperCase().equals(readVIDPID)) {
|
||||
if (readVIDPID.contains(vidPid.toUpperCase())) {
|
||||
Map<String, Object> boardData = new HashMap<String, Object>();
|
||||
boardData.put("board", board);
|
||||
boardData.put("vid", vids.get(i));
|
||||
boardData.put("pid", pids.get(i));
|
||||
boardData.put("iserial", readVIDPID.substring(vidPid.length()+1));
|
||||
return boardData;
|
||||
}
|
||||
}
|
||||
|
@ -12,9 +12,13 @@ public class UDevAdmParser {
|
||||
|
||||
Object vid = properties.get("ID_VENDOR_ID");
|
||||
Object pid = properties.get("ID_MODEL_ID");
|
||||
Object serial = properties.get("ID_SERIAL_SHORT");
|
||||
if (vid == null || pid == null)
|
||||
return null;
|
||||
return ("0x" + vid + "_0x" + pid).toUpperCase();
|
||||
if (serial == null) {
|
||||
serial = "";
|
||||
}
|
||||
return ("0x" + vid + "_0x" + pid).toUpperCase() + "_" + serial;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public class SystemProfilerParser {
|
||||
String computedDevicePathMinusChar = computedDevicePath.substring(0, computedDevicePath.length() - 1);
|
||||
String serialMinusChar = serial.substring(0, serial.length() - 1);
|
||||
if (computedDevicePath.equalsIgnoreCase(serial) || computedDevicePathMinusChar.equalsIgnoreCase(serialMinusChar)) {
|
||||
return (device.get(VID) + "_" + device.get(PID)).toUpperCase();
|
||||
return (device.get(VID) + "_" + device.get(PID)).toUpperCase() + "_" + device.get(SERIAL_NUMBER);
|
||||
}
|
||||
}
|
||||
device = new HashMap<>();
|
||||
|
@ -59,8 +59,9 @@ public class ListComPortsParser {
|
||||
String vidPidPart = lineParts[lineParts.length - 1];
|
||||
Matcher vidMatcher = vidRegExp.matcher(vidPidPart);
|
||||
Matcher pidMatcher = pidRegExp.matcher(vidPidPart);
|
||||
String iSerial = vidPidPart.substring(vidPidPart.lastIndexOf("\\")+1);
|
||||
if (vidMatcher.find() && pidMatcher.find()) {
|
||||
return ("0x" + vidMatcher.group(1) + "_0x" + pidMatcher.group(1)).toUpperCase();
|
||||
return ("0x" + vidMatcher.group(1) + "_0x" + pidMatcher.group(1)).toUpperCase() + "_" + iSerial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user