From 7468dd79e01aac8299e9a39ec2ca9d185bfb7bf3 Mon Sep 17 00:00:00 2001 From: u8array Date: Mon, 19 Oct 2026 17:38:08 +0200 Subject: [PATCH] fix(usb): the usblp fd registers through AsyncFd::register --- src-tauri/Cargo.toml | 2 +- src-tauri/src/usb.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 5d84502c..46a8d8e7 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -20,7 +20,7 @@ tauri = { version = "2.11.3", features = [] } # generate_context! expands plugin config (plugins.updater) via serde_json. serde_json = "1" serde = { version = "1", features = ["derive"] } -tokio = { version = "1", features = ["net", "time", "io-util", "rt"] } +tokio = { version = "1.53.3", features = ["net", "time", "io-util", "rt"] } # Preview proxy only (redirects disabled there); rustls to match sqlx. reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] } base64 = "0.23" diff --git a/src-tauri/src/usb.rs b/src-tauri/src/usb.rs index 1f0b66d0..c0fe3b3f 100644 --- a/src-tauri/src/usb.rs +++ b/src-tauri/src/usb.rs @@ -431,7 +431,8 @@ mod lp_io { impl LpDevice { pub(super) fn new(file: File) -> std::io::Result { - Ok(Self(AsyncFd::new(file)?)) + // SAFETY: the File owns the fd for the whole lifetime of the AsyncFd. + Ok(Self(unsafe { AsyncFd::register(file) }?)) } }