@Override
    public synchronized void open() throws IOException {
        if (isOpen()) {
            return;
        }

        CommPortIdentifier portIdentifier;
        CommPort comPort;

        Enumeration e = CommPortIdentifier.getPortIdentifiers();
        while (e.hasMoreElements()) {
            CommPortIdentifier c = (CommPortIdentifier)e.nextElement();
            log.info("found port: "+c.getName());
        }

        try {
            log.info("opening: "+portName);
            portIdentifier = CommPortIdentifier.getPortIdentifier(portName);
        } catch (NoSuchPortException ex) {
            throw new IOException(ex);
        }

        if (portIdentifier.isCurrentlyOwned()) {
            throw new IOException("isCurrentlyOwned");
        }
        
        try {
            comPort = portIdentifier.open(this.getClass().getName(), 2000);
        } catch (PortInUseException ex) {
            throw new IOException(ex);
        }

        if (comPort instanceof SerialPort) {
            {
                try {
                    this.serialPort = (SerialPort) comPort;
                    serialPort.setSerialPortParams(getBaudRate(), getDataBits(), getStopBits(), getParity());
                    inputStream = serialPort.getInputStream();
                    outputStream = serialPort.getOutputStream();
                } catch (UnsupportedCommOperationException ex) {
                    throw new IOException(ex);
                }
            }
        }
        else {
            throw new IOException("Unknow com port");
        }
    }