#low-latency #serial-port #serial-communication #serial #latency #ftdi #linux

serialport_low_latency

Enable or disable low latency mode for serial ports on Linux

2 releases

0.1.1 Jul 12, 2024
0.1.0 Jun 27, 2023

#1730 in Hardware support

Download history 4/week @ 2024-12-04 4/week @ 2024-12-11 5/week @ 2024-12-25 10/week @ 2025-01-01 23/week @ 2025-02-05 8/week @ 2025-02-12 48/week @ 2025-02-19 35/week @ 2025-02-26

114 downloads per month
Used in profirust

MIT license

9KB
82 lines

serialport_low_latency

license crates.io docs.rs

FTDI serial communication chips support a low latency mode where the latency timer is reduced to 1 ms. This package allows enabling and disabling this low latency mode on Linux via the TIOCSSERIAL ioctl.

Examples

Open a serial port and enable low latency mode

use std::time::Duration;
use serialport_low_latency::enable_low_latency;
let mut port = serialport::new("/dev/ttyUSB0", 115_200)
    .timeout(Duration::from_millis(10))
    .open_native().expect("Failed to open port");
enable_low_latency(&mut port).unwrap();

Open a serial port and disable low latency mode

use std::time::Duration;
use serialport_low_latency::disable_low_latency;
let mut port = serialport::new("/dev/ttyUSB0", 115_200)
    .timeout(Duration::from_millis(10))
    .open_native().expect("Failed to open port");
disable_low_latency(&mut port).unwrap();

Dependencies

~1.9–5MB
~92K SLoC