diff --git a/drivers/input/usbhidd/src/main.rs b/drivers/input/usbhidd/src/main.rs index 80ffcfebf0..c716b0d324 100644 --- a/drivers/input/usbhidd/src/main.rs +++ b/drivers/input/usbhidd/src/main.rs @@ -338,21 +338,27 @@ fn main() -> Result<()> { } if let Some(endpoint) = &mut endpoint_opt { - // interrupt transfer - endpoint - .transfer_read(&mut report_buffer) - .context("failed to get report")?; + match endpoint.transfer_read(&mut report_buffer) { + Ok(_) => {} + Err(e) => { + log::warn!("usbhidd: interrupt transfer failed: {} — retrying", e); + continue; + } + } } else { - // control transfer - reqs::get_report( + match reqs::get_report( &handle, report_ty, report_id, - //TODO: should this be an index into interface_descs? interface_num as u16, &mut report_buffer, - ) - .context("failed to get report")?; + ) { + Ok(()) => {} + Err(e) => { + log::warn!("usbhidd: control transfer failed: {} — retrying", e); + continue; + } + } } let mut mouse_pos = last_mouse_pos;