From 0d2471fef27c6abe5cb34f59f80c5c53ba07da19 Mon Sep 17 00:00:00 2001 From: Brian Cully Date: Sun, 28 Jul 2019 16:44:35 -0400 Subject: Update notes on short packets. --- usbh/src/pipe.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'usbh') diff --git a/usbh/src/pipe.rs b/usbh/src/pipe.rs index 388b518..835ba86 100644 --- a/usbh/src/pipe.rs +++ b/usbh/src/pipe.rs @@ -202,7 +202,7 @@ impl Pipe<'_, '_> { buf: &mut T, nak_limit: usize, millis: &dyn Fn() -> usize, - ) -> Result<(usize), PipeErr> { + ) -> Result { // TODO: pull this from pipe descriptor for this addr/ep. let packet_size = 8; @@ -217,6 +217,10 @@ impl Pipe<'_, '_> { // Read until we get a short packet (indicating that there's // nothing left for us in this transaction) or the buffer is // full. + // + // TODO: It is sometimes valid to get a short packet when + // variable length data is desired by the driver. cf ยง5.3.2 of + // USB 2.0. let mut bytes_received = 0; while bytes_received < db.len { // Move the buffer pointer forward as we get data. @@ -231,11 +235,6 @@ impl Pipe<'_, '_> { bytes_received += recvd; trace!("!! read {} of {}", bytes_received, db.len); if recvd < packet_size { - // If we receive a short packet, we should be done - // here. It /may/ be possible to get a short packet - // and continue, but only if recvd is a word-sized - // multiple. I'm going to assume, for simplicity's - // sake, that that's not possible. break; } -- cgit v1.2.3