mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
Merge pull request #62 from sgh/master
Set low-latency flag on serial port. Thanks for monitoring!
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <linux/tty.h>
|
#include <linux/tty.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
|
#include <linux/serial.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
/* Change this to whatever your daemon is called */
|
/* Change this to whatever your daemon is called */
|
||||||
@@ -310,6 +311,13 @@ int main(int argc, char *argv[])
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Because of a recent change in linux - https://patchwork.kernel.org/patch/9589541/
|
||||||
|
// we need to set low latency flag to get proper receive latency
|
||||||
|
struct serial_struct snew;
|
||||||
|
ioctl (fd, TIOCGSERIAL, &snew);
|
||||||
|
snew.flags |= ASYNC_LOW_LATENCY;
|
||||||
|
ioctl (fd, TIOCSSERIAL, &snew);
|
||||||
|
|
||||||
/* Get old values for later restore */
|
/* Get old values for later restore */
|
||||||
old_ispeed = cfgetispeed(&tios);
|
old_ispeed = cfgetispeed(&tios);
|
||||||
old_ospeed = cfgetospeed(&tios);
|
old_ospeed = cfgetospeed(&tios);
|
||||||
|
|||||||
Reference in New Issue
Block a user