From ecd5fd858b423ef3f2d8bd8e804babf2840caf62 Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Wed, 24 May 2017 13:46:28 +0200 Subject: [PATCH] trezorhal/usb: do not send full packets --- micropython/trezorhal/usb_vcp-impl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/micropython/trezorhal/usb_vcp-impl.h b/micropython/trezorhal/usb_vcp-impl.h index 317ec3c9..3e24bb4b 100644 --- a/micropython/trezorhal/usb_vcp-impl.h +++ b/micropython/trezorhal/usb_vcp-impl.h @@ -408,8 +408,9 @@ static uint8_t usb_vcp_class_sof(USBD_HandleTypeDef *dev, usb_vcp_state_t *state // Read from the tx ring buffer usb_rbuf_t *b = &state->tx_ring; uint8_t *buf = state->tx_packet; - size_t len = state->max_packet_len; - size_t mask = b->cap - 1; + // We avoid sending full packets as they stall the hosts pipeline, see: + // + size_t len = state->max_packet_len - 1; size_t i; for (i = 0; (i < len) && !ring_empty(b); i++) { buf[i] = b->buf[b->read & mask];