set ASYNC_LOW_LATENCY flag on serial device just like setserial does to fix huge latency found on recent kernel versions
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#ifdef HAVE_LINUX_SERIAL
|
||||
# include <linux/serial.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_PPOLL
|
||||
# include <poll.h>
|
||||
@@ -190,6 +193,14 @@ result_t SerialDevice::open() {
|
||||
return RESULT_ERR_DEVICE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LINUX_SERIAL
|
||||
struct serial_struct serial;
|
||||
if (ioctl(m_fd, TIOCGSERIAL, &serial) == 0) {
|
||||
serial.flags |= ASYNC_LOW_LATENCY;
|
||||
ioctl(m_fd, TIOCSSERIAL, &serial);
|
||||
}
|
||||
#endif
|
||||
|
||||
// save current settings
|
||||
tcgetattr(m_fd, &m_oldSettings);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user