From ae5c9f4f25ce91376fcd7d5ae6acbdb49cf8c4c9 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Thu, 26 Jun 2025 03:00:04 -0500 Subject: [PATCH] server hid stream fix --- server/src/main.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/server/src/main.rs b/server/src/main.rs index b40d6dc..9c36731 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -158,7 +158,13 @@ impl Relay for Handler { .map(|b| format!("{b:02X}")).collect::>().join(" ")); break; }, - Err(e) if matches!(e.raw_os_error(), Some(libc::EBUSY) | Some(libc::EAGAIN)) => { + Err(e) + if matches!(e.raw_os_error(), + Some(libc::EBUSY) | // still opening + Some(libc::ENODEV) | // gadget not‑yet configured + Some(libc::EPIPE) | // host vanished + Some(libc::EAGAIN)) // non‑blocking + => { tokio::time::sleep(Duration::from_millis(10)).await; continue; } @@ -191,7 +197,13 @@ impl Relay for Handler { .map(|b| format!("{b:02X}")).collect::>().join(" ")); break; } - Err(e) if matches!(e.raw_os_error(), Some(libc::EBUSY) | Some(libc::EAGAIN)) => { + Err(e) + if matches!(e.raw_os_error(), + Some(libc::EBUSY) | // still opening + Some(libc::ENODEV) | // gadget not‑yet configured + Some(libc::EPIPE) | // host vanished + Some(libc::EAGAIN)) // non‑blocking + => { tokio::time::sleep(Duration::from_millis(10)).await; continue; }