I added this test into our code – prior to the first port discovery attempt:
logger.info("HFCtest -- Opening port via RXTX w/ Datex parameters");
CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier(address.getName());
SerialPort serialPort = (SerialPort) portId.open("Demo application", 5000);
serialPort.setSerialPortParams(19200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN);
logger.info(" Setting hardware flow control");
logger.info(" Port is open. Holding 5 seconds");
logger.info(" Closing port and continuing");
catch (NoSuchPortException e)
logger.error("getPortIdentifier failure", e);
catch (PortInUseException e)
logger.error("open failure", e);
catch (UnsupportedCommOperationException e)
logger.error("setSerialPortParams() or setFlowControlMode() failure", e);
catch (InterruptedException e)
logger.error("Sleep interrupted", e);
My logs show the port being opened, hardware flow control being set, the 5-second pause, and the port being closed again. None of the catch clauses above is executed.
Discovery then proceeds normally with Flow control NONE devices and everything works fine.
Add in even one Hardware flow control (RTSCTS_IN_OUT) and the port is flagged "in use" on all subsequent attempts.
I have switched device drivers around – took a previously proven non-flow controlled device driver and set it to use hardware flow control – the results are exactly the same.
Once Mina opens a Windows serial port with hardware flow control, the port cannot be re-used until the program is exited and restarted.