From cbb18cf4146267c1c7b6509d42fa77775b1485d1 Mon Sep 17 00:00:00 2001 From: Mateusz Faderewski Date: Mon, 4 Mar 2024 11:35:46 +0000 Subject: [PATCH] Fix write timeout for Unix platforms --- src/sys/unix/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sys/unix/mod.rs b/src/sys/unix/mod.rs index 69e15f7..0e4c4ed 100644 --- a/src/sys/unix/mod.rs +++ b/src/sys/unix/mod.rs @@ -219,7 +219,7 @@ impl SerialPort { } pub fn write(&self, buf: &[u8]) -> std::io::Result { - if !poll(&self.file, libc::POLLOUT, self.read_timeout_ms)? { + if !poll(&self.file, libc::POLLOUT, self.write_timeout_ms)? { return Err(std::io::ErrorKind::TimedOut.into()); } unsafe { @@ -234,7 +234,7 @@ impl SerialPort { } pub fn write_vectored(&self, buf: &[IoSlice<'_>]) -> std::io::Result { - if !poll(&self.file, libc::POLLOUT, self.read_timeout_ms)? { + if !poll(&self.file, libc::POLLOUT, self.write_timeout_ms)? { return Err(std::io::ErrorKind::TimedOut.into()); } unsafe {