1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-19 08:52:15 +01:00

Do not drop serial ports with underscore in the name

solves #4857
This commit is contained in:
Martino Facchin 2016-04-15 10:01:47 +02:00
parent 93578cef42
commit 2ddbf01334

View File

@ -94,13 +94,23 @@ public class SerialBoardsLister extends TimerTask {
for (String newPort : ports) { for (String newPort : ports) {
String[] parts = newPort.split("_"); String[] parts = newPort.split("_");
String port = parts[0];
if (parts.length != 3) { if (parts.length < 3) {
// something went horribly wrong // something went horribly wrong
continue; continue;
} }
if (parts.length > 3) {
// port name with _ in it (like CP2102 on OSX)
for (int i = 1; i < (parts.length-2); i++) {
parts[0] += "_" + parts[i];
}
parts[1] = parts[parts.length-2];
parts[2] = parts[parts.length-1];
}
String port = parts[0];
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages); Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
BoardPort boardPort = null; BoardPort boardPort = null;