mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Merge pull request #2626 from ffissore/hide-cu-devs-on-mac
Macosx: filter out /dev/cu* ports
This commit is contained in:
commit
cf3e9480a5
@ -1004,6 +1004,8 @@ public class Editor extends JFrame implements RunnerListener {
|
|||||||
|
|
||||||
List<BoardPort> ports = Base.getDiscoveryManager().discovery();
|
List<BoardPort> ports = Base.getDiscoveryManager().discovery();
|
||||||
|
|
||||||
|
ports = Base.getPlatform().filterPorts(ports, Preferences.getBoolean("serial.ports.showall"));
|
||||||
|
|
||||||
Collections.sort(ports, new Comparator<BoardPort>() {
|
Collections.sort(ports, new Comparator<BoardPort>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(BoardPort o1, BoardPort o2) {
|
public int compare(BoardPort o1, BoardPort o2) {
|
||||||
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
|
import cc.arduino.packages.BoardPort;
|
||||||
import com.sun.jna.Library;
|
import com.sun.jna.Library;
|
||||||
import com.sun.jna.Native;
|
import com.sun.jna.Native;
|
||||||
import processing.app.debug.TargetBoard;
|
import processing.app.debug.TargetBoard;
|
||||||
@ -217,4 +218,8 @@ public class Platform {
|
|||||||
_("Unspecified platform, no launcher available.\nTo enable opening URLs or folders, add a \n\"launcher=/path/to/app\" line to preferences.txt"),
|
_("Unspecified platform, no launcher available.\nTo enable opening URLs or folders, add a \n\"launcher=/path/to/app\" line to preferences.txt"),
|
||||||
null);
|
null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<BoardPort> filterPorts(List<BoardPort> ports, boolean aBoolean) {
|
||||||
|
return new LinkedList<BoardPort>(ports);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
package processing.app.macosx;
|
package processing.app.macosx;
|
||||||
|
|
||||||
|
import cc.arduino.packages.BoardPort;
|
||||||
import com.apple.eio.FileManager;
|
import com.apple.eio.FileManager;
|
||||||
import org.apache.commons.exec.CommandLine;
|
import org.apache.commons.exec.CommandLine;
|
||||||
import org.apache.commons.exec.Executor;
|
import org.apache.commons.exec.Executor;
|
||||||
@ -35,7 +36,8 @@ import java.awt.*;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Map;
|
import java.util.*;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -239,4 +241,20 @@ public class Platform extends processing.app.Platform {
|
|||||||
return super.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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user