diff --git a/pom.xml b/pom.xml
index e81ed66ce..9154a36ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,6 +32,7 @@
4.12
1.2.3
2.3.3
+ 1.7.25
1.17
@@ -62,6 +63,12 @@
+
+ org.slf4j
+ slf4j-api
+ ${dependency.slf4j-api.version}
+ provided
+
org.scijava
native-lib-loader
diff --git a/src/java/jssc/SerialPortList.java b/src/java/jssc/SerialPortList.java
index 5af9a95ea..a886b1d71 100644
--- a/src/java/jssc/SerialPortList.java
+++ b/src/java/jssc/SerialPortList.java
@@ -53,7 +53,7 @@ public class SerialPortList {
break;
}
case SerialNativeInterface.OS_MAC_OS_X: {
- PORTNAMES_REGEXP = Pattern.compile("tty.(serial|usbserial|usbmodem).*");
+ PORTNAMES_REGEXP = Pattern.compile("(tty|cu)\\..*");
PORTNAMES_PATH = "/dev/";
break;
}
@@ -155,7 +155,7 @@ private int[] getNumberAndLastIndex(String str, int startIndex) {
}
};
//<-since 2.1.0
-
+
/**
* Get sorted array of serial ports in the system using default settings:
*
@@ -199,7 +199,7 @@ public static String[] getPortNames(String searchPath) {
* Get sorted array of serial ports in the system matched pattern
*
* @param pattern RegExp pattern for matching port names (not null)
- *
+ *
* @return String array. If there is no ports in the system String[]
*
* @since 2.3.0
@@ -330,12 +330,15 @@ private static String[] getUnixBasedPortNames(String searchPath, Pattern pattern
String fileName = file.getName();
if(!file.isDirectory() && !file.isFile() && pattern.matcher(fileName).find()){
String portName = searchPath + fileName;
- long portHandle = serialInterface.openPort(portName, false);//Open port without TIOCEXCL
- if(portHandle < 0 && portHandle != SerialNativeInterface.ERR_PORT_BUSY){
- continue;
- }
- else if(portHandle != SerialNativeInterface.ERR_PORT_BUSY) {
- serialInterface.closePort(portHandle);
+ // For linux ttyS0..31 serial ports check existence by opening each of them
+ if (fileName.startsWith("ttyS")) {
+ long portHandle = serialInterface.openPort(portName, false);//Open port without TIOCEXCL
+ if(portHandle < 0 && portHandle != SerialNativeInterface.ERR_PORT_BUSY){
+ continue;
+ }
+ else if(portHandle != SerialNativeInterface.ERR_PORT_BUSY) {
+ serialInterface.closePort(portHandle);
+ }
}
portsTree.add(portName);
}