File tree 1 file changed +9
-1
lines changed
it.baeyens.arduino.common/src/it/baeyens/arduino/arduino
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 31
31
import java .util .Arrays ;
32
32
import java .util .List ;
33
33
import java .util .Vector ;
34
+ import java .util .regex .Pattern ;
34
35
35
36
import jssc .SerialPort ;
36
37
import jssc .SerialPortEvent ;
@@ -68,7 +69,14 @@ static public void errorMessage(String where, Throwable e) {
68
69
*/
69
70
public static Vector <String > list () {
70
71
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
+ }
72
80
return new Vector <String >(Arrays .asList (portNames ));
73
81
} catch (Error e ) {
74
82
Common .log (new Status (IStatus .ERROR , ArduinoConst .CORE_PLUGIN_ID ,
You can’t perform that action at this time.
0 commit comments