server hid stream fix

This commit is contained in:
Brad Stein 2025-06-26 03:00:04 -05:00
parent b63e04ff95
commit ae5c9f4f25

View File

@ -158,7 +158,13 @@ impl Relay for Handler {
.map(|b| format!("{b:02X}")).collect::<Vec<_>>().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 notyet configured
Some(libc::EPIPE) | // host vanished
Some(libc::EAGAIN)) // nonblocking
=> {
tokio::time::sleep(Duration::from_millis(10)).await;
continue;
}
@ -191,7 +197,13 @@ impl Relay for Handler {
.map(|b| format!("{b:02X}")).collect::<Vec<_>>().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 notyet configured
Some(libc::EPIPE) | // host vanished
Some(libc::EAGAIN)) // nonblocking
=> {
tokio::time::sleep(Duration::from_millis(10)).await;
continue;
}