You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When serial port is created through SerialPortBuilder and .timeout() is called with the argument set to Duration::MAX, any attempt to read from the port returns an error Custom { kind: Other, error: "Invalid argument" }.
Apparently there is no other way to set blocking read without a timeout.
Code to reproduce:
use std::{time::Duration, error::Error};fnmain() -> Result<(),Box<dynError>>{letmut serial = serialport::new("/dev/ttyUSB0",9600).timeout(Duration::MAX).open()?;letmut tmp = vec![0];
serial.read(&mut tmp)?;dbg!(tmp);Ok(())}
Environment:
Fedora 40
6.9.11-200.fc40.x86_64
rustc 1.79.0 (129f3b996 2024-06-10)
serialport = "4.4.0"
/dev/ttyUSB0: ID 1a86:7523 QinHeng Electronics CH340 serial converter