summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Thierer <[email protected]>2021-07-20 18:55:00 +0200
committerMartin Thierer <[email protected]>2021-07-20 18:55:00 +0200
commitf607a99127cc9e8dfc3f716f977e6c1bfb6f7c2d (patch)
tree5ac92d38b07d424478ac14314050dd8b36cd0403 /src
parentd49938d0f5052bce70e55c652b657c0a6a7e84fe (diff)
Send a ZLP if nothing to transfer and last transfer was EPSIZE
Diffstat (limited to 'src')
-rw-r--r--src/class/vendor/vendor_device.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c
index 6718a97bf..5b58d85e1 100644
--- a/src/class/vendor/vendor_device.c
+++ b/src/class/vendor/vendor_device.c
@@ -61,6 +61,8 @@ typedef struct
CFG_TUSB_MEM_SECTION static vendord_interface_t _vendord_itf[CFG_TUD_VENDOR];
+CFG_TUSB_MEM_SECTION static bool last_in_transfer_was_epsize = false;
+
#define ITF_MEM_RESET_SIZE offsetof(vendord_interface_t, rx_ff)
@@ -112,10 +114,11 @@ static bool maybe_transmit(vendord_interface_t* p_itf)
TU_VERIFY( !usbd_edpt_busy(TUD_OPT_RHPORT, p_itf->ep_in) );
uint16_t count = tu_fifo_read_n(&p_itf->tx_ff, p_itf->epin_buf, CFG_TUD_VENDOR_EPSIZE);
- if (count > 0)
+ if (count > 0 || last_in_transfer_was_epsize)
{
TU_ASSERT( usbd_edpt_xfer(TUD_OPT_RHPORT, p_itf->ep_in, p_itf->epin_buf, count) );
}
+ last_in_transfer_was_epsize = count && (count == CFG_TUD_VENDOR_EPSIZE);
return true;
}