Cleared "getUnixBasedPortNames()" method is SerialPortList class
This commit is contained in:
parent
f4e725252f
commit
e23a29229c
|
@ -190,23 +190,13 @@ public class SerialPortList {
|
||||||
if(!file.isDirectory() && !file.isFile() && PORTNAMES_REGEXP.matcher(fileName).find()){
|
if(!file.isDirectory() && !file.isFile() && PORTNAMES_REGEXP.matcher(fileName).find()){
|
||||||
String portName = PORTNAMES_PATH + fileName;
|
String portName = PORTNAMES_PATH + fileName;
|
||||||
if(SerialNativeInterface.getOsType() == SerialNativeInterface.OS_LINUX){
|
if(SerialNativeInterface.getOsType() == SerialNativeInterface.OS_LINUX){
|
||||||
SerialPort serialPort = new SerialPort(portName);
|
int portHandle = serialInterface.openPort(portName, false);//Open port without TIOCEXCL
|
||||||
//try {
|
if(portHandle < 0 && portHandle != -1){//If port handle == -1 it's mean that it's busy
|
||||||
/*serialPort.openPort();
|
|
||||||
serialPort.closePort();*/
|
|
||||||
int portHandle = serialInterface.openPort(portName, false, true);
|
|
||||||
if(portHandle < 0 && portHandle != -1){
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if(portHandle != -1) {
|
else if(portHandle != -1) {
|
||||||
serialInterface.closePort(portHandle);
|
serialInterface.closePort(portHandle);
|
||||||
}
|
}
|
||||||
//}
|
|
||||||
//catch (SerialPortException ex) {
|
|
||||||
// if(!ex.getExceptionType().equals(SerialPortException.TYPE_PORT_BUSY)){
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
portsTree.add(portName);
|
portsTree.add(portName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue