Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/src/processing/app/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,8 @@ protected void populatePortMenu() {

List<BoardPort> ports = Base.getDiscoveryManager().discovery();

ports = Base.getPlatform().filterPorts(ports, Preferences.getBoolean("serial.ports.showall"));

Collections.sort(ports, new Comparator<BoardPort>() {
@Override
public int compare(BoardPort o1, BoardPort o2) {
Expand Down
5 changes: 5 additions & 0 deletions arduino-core/src/processing/app/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import javax.swing.UIManager;

import cc.arduino.packages.BoardPort;
import com.sun.jna.Library;
import com.sun.jna.Native;
import processing.app.debug.TargetBoard;
Expand Down Expand Up @@ -217,4 +218,8 @@ protected void showLauncherWarning() {
_("Unspecified platform, no launcher available.\nTo enable opening URLs or folders, add a \n\"launcher=/path/to/app\" line to preferences.txt"),
null);
}

public List<BoardPort> filterPorts(List<BoardPort> ports, boolean aBoolean) {
return new LinkedList<BoardPort>(ports);
}
}
20 changes: 19 additions & 1 deletion arduino-core/src/processing/app/macosx/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

package processing.app.macosx;

import cc.arduino.packages.BoardPort;
import com.apple.eio.FileManager;
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.Executor;
Expand All @@ -35,7 +36,8 @@
import java.io.*;
import java.lang.reflect.Method;
import java.net.URI;
import java.util.Map;
import java.util.*;
import java.util.List;


/**
Expand Down Expand Up @@ -239,4 +241,20 @@ public String preListAllCandidateDevices() {
return super.preListAllCandidateDevices();
}
}

@Override
public java.util.List<BoardPort> filterPorts(java.util.List<BoardPort> ports, boolean showAll) {
if (showAll) {
return super.filterPorts(ports, true);
}

List<BoardPort> filteredPorts = new LinkedList<BoardPort>();
for (BoardPort port : ports) {
if (!port.getAddress().startsWith("/dev/cu.")) {
filteredPorts.add(port);
}
}

return filteredPorts;
}
}