Skip to content

Commit 2ddbf01

Browse files
committed
Do not drop serial ports with underscore in the name
solves #4857
1 parent 93578ce commit 2ddbf01

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

arduino-core/src/cc/arduino/packages/discoverers/serial/SerialBoardsLister.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,23 @@ public synchronized void retriggerDiscovery(boolean polled) {
9494
for (String newPort : ports) {
9595

9696
String[] parts = newPort.split("_");
97-
String port = parts[0];
9897

99-
if (parts.length != 3) {
98+
if (parts.length < 3) {
10099
// something went horribly wrong
101100
continue;
102101
}
103102

103+
if (parts.length > 3) {
104+
// port name with _ in it (like CP2102 on OSX)
105+
for (int i = 1; i < (parts.length-2); i++) {
106+
parts[0] += "_" + parts[i];
107+
}
108+
parts[1] = parts[parts.length-2];
109+
parts[2] = parts[parts.length-1];
110+
}
111+
112+
String port = parts[0];
113+
104114
Map<String, Object> boardData = platform.resolveDeviceByVendorIdProductId(port, BaseNoGui.packages);
105115

106116
BoardPort boardPort = null;

0 commit comments

Comments
 (0)