if (r == 0)
r = tcsetattr(fd, TCSANOW, termios);
if (r != 0) {
// Darell Tan had patched RXTX with this sequence, so lets try this
if (cfsetispeed(termios, B9600) == 0 && cfsetospeed(termios, B9600) == 0 && tcsetattr(fd, TCSANOW, termios) == 0) {
NativeLong[] data = new NativeLong[] { new NativeLong(speed) };
r = ioctl(fd, IOSSIOSPEED, data);
}
}
return r;
}