From cf89c855690f705744d875c4be7cebea1a133f7e Mon Sep 17 00:00:00 2001 From: alexmoon Date: Thu, 31 Mar 2022 10:04:41 -0400 Subject: [PATCH] Log when reports are dropped without being read. --- embassy-usb-hid/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/embassy-usb-hid/src/lib.rs b/embassy-usb-hid/src/lib.rs index c1f70c32..14aadbc8 100644 --- a/embassy-usb-hid/src/lib.rs +++ b/embassy-usb-hid/src/lib.rs @@ -454,12 +454,18 @@ impl<'d, const OUT_N: usize, const FEATURE_N: usize> ControlHandler Ok(ReportId::Out(_id)) => { let mut buf = [0; OUT_N]; buf[0..data.len()].copy_from_slice(data); + if self.out_signal.signaled() { + warn!("Output report dropped before being read!"); + } self.out_signal.signal((data.len(), buf)); OutResponse::Accepted } Ok(ReportId::Feature(_id)) => { let mut buf = [0; FEATURE_N]; buf[0..data.len()].copy_from_slice(data); + if self.feature_signal.signaled() { + warn!("Feature report dropped before being read!"); + } self.feature_signal.signal((data.len(), buf)); OutResponse::Accepted }