aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2022-04-06 02:18:56 +0200
committerDario Nieuwenhuis <[email protected]>2022-04-06 05:38:11 +0200
commitde9acf5d48151f1c9ca0b42d699e92b8502bebad (patch)
treeedf89042e41b3e67f3096f317e8c02ab057d99d7
parent6d514a0b31a6e480d00a36132ccd41bebfd246cc (diff)
usb/hid: fix infinite loop when N=0
-rw-r--r--embassy-usb-hid/src/lib.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/embassy-usb-hid/src/lib.rs b/embassy-usb-hid/src/lib.rs
index e29d485f4..996de6a5b 100644
--- a/embassy-usb-hid/src/lib.rs
+++ b/embassy-usb-hid/src/lib.rs
@@ -252,6 +252,7 @@ impl<'d, D: Driver<'d>, const N: usize> ReportReader<'d, D, N> {
252 /// `read()`. If the dropped future used the same `buf`, then `buf` will 252 /// `read()`. If the dropped future used the same `buf`, then `buf` will
253 /// contain the full report. 253 /// contain the full report.
254 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> { 254 pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, ReadError> {
255 assert!(N != 0);
255 assert!(buf.len() >= N); 256 assert!(buf.len() >= N);
256 257
257 // Read packets from the endpoint 258 // Read packets from the endpoint