File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
it.baeyens.arduino.common/src/it/baeyens/arduino/arduino Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 3131import java .util .Arrays ;
3232import java .util .List ;
3333import java .util .Vector ;
34+ import java .util .regex .Pattern ;
3435
3536import jssc .SerialPort ;
3637import jssc .SerialPortEvent ;
@@ -68,7 +69,14 @@ static public void errorMessage(String where, Throwable e) {
6869 */
6970 public static Vector <String > list () {
7071 try {
71- String [] portNames = SerialPortList .getPortNames ();
72+ String [] portNames ;
73+ String OS = System .getProperty ("os.name" ).toLowerCase ();
74+ if (OS .indexOf ("mac" ) >= 0 ) {
75+ portNames = SerialPortList .getPortNames ("/dev/" , Pattern .compile ("tty.*" ));
76+ }
77+ else {
78+ portNames = SerialPortList .getPortNames ();
79+ }
7280 return new Vector <String >(Arrays .asList (portNames ));
7381 } catch (Error e ) {
7482 Common .log (new Status (IStatus .ERROR , ArduinoConst .CORE_PLUGIN_ID ,
You can’t perform that action at this time.
0 commit comments