aboutsummaryrefslogtreecommitdiffstats
path: root/usbh/src
diff options
context:
space:
mode:
Diffstat (limited to 'usbh/src')
-rw-r--r--usbh/src/pipe.rs11
1 files changed, 5 insertions, 6 deletions
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<usize, PipeErr> {
// 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;
}