Merge pull request #353 from chargeITmobility/fix-rs485-delays

Fix RS-485 delays passed to ioctl
This commit is contained in:
Will Hedgecock 2021-10-22 12:30:03 -05:00 committed by GitHub
commit c1684de18e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -396,8 +396,11 @@ JNIEXPORT jboolean JNICALL Java_com_fazecast_jSerialComm_SerialPort_configPort(J
rs485Conf.flags &= ~(SER_RS485_RTS_ON_SEND);
rs485Conf.flags |= SER_RS485_RTS_AFTER_SEND;
}
rs485Conf.delay_rts_before_send = rs485DelayBefore;
rs485Conf.delay_rts_after_send = rs485DelayAfter;
// SerialPort defines delays in microseconds and Linux expects
// milliseconds (see
// https://github.com/torvalds/linux/blob/0c18f29aae7ce3dadd26d8ee3505d07cc982df75/include/uapi/linux/serial.h#L129).
rs485Conf.delay_rts_before_send = rs485DelayBefore / 1000;
rs485Conf.delay_rts_after_send = rs485DelayAfter / 1000;
ioctl(serialPortFD, TIOCSRS485, &rs485Conf);
}
#endif