From 3363195bef583f87552bd0ccc96c81724316fae6 Mon Sep 17 00:00:00 2001 From: scream3r Date: Mon, 22 Apr 2013 11:30:55 +0400 Subject: [PATCH] Removed port opening only for Linux in "getUnixBasedPortNames()" method of SerialPortList class, now port opening will be used on all _unix_based systems, because it can help to get real serial devices --- src/java/jssc/SerialPortList.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/java/jssc/SerialPortList.java b/src/java/jssc/SerialPortList.java index 021fc79..5f00ca9 100644 --- a/src/java/jssc/SerialPortList.java +++ b/src/java/jssc/SerialPortList.java @@ -330,14 +330,12 @@ public class SerialPortList { String fileName = file.getName(); if(!file.isDirectory() && !file.isFile() && pattern.matcher(fileName).find()){ String portName = searchPath + fileName; - if(SerialNativeInterface.getOsType() == SerialNativeInterface.OS_LINUX){ - int portHandle = serialInterface.openPort(portName, false);//Open port without TIOCEXCL - if(portHandle < 0 && portHandle != SerialNativeInterface.ERR_PORT_BUSY){//If port handle == -1 it's mean that it's busy - continue; - } - else if(portHandle != -1) { - serialInterface.closePort(portHandle); - } + int 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); }