New Binding - trouble with NRSerialPort

Not sure if I chose the right tag?!

  • Platform information:
    • Hardware: Raspi 2
    • OS: Raspian latest
    • Java Runtime Environment: oracle-java8-jdk
    • openHAB version: latest 2.1.0
  • Issue of the topic:
    I (non-native-java) wrote a binding that uses serial port communication. On my Windows Eclipse machine all works fine (On windows I only use the debugger to run OpenHAB and test the binding).
    But when putting die lib onto the Raspberry Pi it’s not working. NRSerialPort.getAvailableSerialPorts() never finds any port (empty array).
    Homegear is flawlessly communicating on /dev/ttyUSB0
    /dev/ttyUSB1 which my binding should use, also works fine with minicom.

I guess this has something to do with that gnu.io lib. I had to install LG TV Serial binding, to get 3.12.0.OH nrjavaserial installed.
Any ideas why I don’t get any working ports with NRSerialPort?

code snippet of the serial com class:

public class SerialConnection {
    private final int baudRate = 57600;
    private final Logger logger = LoggerFactory.getLogger(SerialConnection.class);
    private final String portName;
    private NRSerialPort serialPort;

    public SerialConnection(String portName) {
        this.portName = portName;
    }

    public Boolean connect() {
        try {
            if (portNameExists(portName)) {  // <---- FALSE
                serialPort = new NRSerialPort(portName, baudRate);
                if (!serialPort.connect()) {
                    throw new IOException("Failed to connect on port " + portName);
                }
                return true;
            } else {
                String ports = NRSerialPort.getAvailableSerialPorts().toString(); // <---- EMPTY
                logger.error("Serial port with name '{}' does not exist. Available port names: {}", portName, ports);
                return false;
            }
        } catch (Exception e) {          
            logger.error("exception on creating connection for {}: {}", portName, e);
            return false;
        }
    }

Did some wider search and found:

So the simple answer to my problem: add user openhab to group dialout.

Why isn’t this done during setup? Homegear setup does so…

Regards