Fixed "openPort()" invocations in considering of last changes
This commit is contained in:
parent
273e132321
commit
6d542e09a1
|
@ -146,7 +146,7 @@ public class SerialPort {
|
|||
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_ALREADY_OPENED);
|
||||
}
|
||||
if(portName != null){
|
||||
portHandle = serialInterface.openPort(portName);
|
||||
portHandle = serialInterface.openPort(portName, true, false);
|
||||
}
|
||||
else {
|
||||
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_NULL_NOT_PERMITTED);//since 2.1.0 -> NULL port name fix
|
||||
|
|
|
@ -191,15 +191,22 @@ public class SerialPortList {
|
|||
String portName = PORTNAMES_PATH + fileName;
|
||||
if(SerialNativeInterface.getOsType() == SerialNativeInterface.OS_LINUX){
|
||||
SerialPort serialPort = new SerialPort(portName);
|
||||
try {
|
||||
serialPort.openPort();
|
||||
serialPort.closePort();
|
||||
}
|
||||
catch (SerialPortException ex) {
|
||||
if(!ex.getExceptionType().equals(SerialPortException.TYPE_PORT_BUSY)){
|
||||
//try {
|
||||
/*serialPort.openPort();
|
||||
serialPort.closePort();*/
|
||||
int portHandle = serialInterface.openPort(portName, false, true);
|
||||
if(portHandle < 0 && portHandle != -1){
|
||||
continue;
|
||||
}
|
||||
else if(portHandle != -1) {
|
||||
serialInterface.closePort(portHandle);
|
||||
}
|
||||
//}
|
||||
//catch (SerialPortException ex) {
|
||||
// if(!ex.getExceptionType().equals(SerialPortException.TYPE_PORT_BUSY)){
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
portsTree.add(portName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue