summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/usbd_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/usbd_core.c b/core/usbd_core.c
index 6e88ecdb..ce4e4abc 100644
--- a/core/usbd_core.c
+++ b/core/usbd_core.c
@@ -982,7 +982,7 @@ static void usbd_send_to_host(uint16_t len)
* last chunk is wMaxPacketSize long, to indicate the last
* packet.
*/
- if ((!usbd_core_cfg.ep0_data_buf_residue) && (usbd_core_cfg.ep0_data_buf_len >= USB_CTRL_EP_MPS) && !(usbd_core_cfg.ep0_data_buf_len % USB_CTRL_EP_MPS)) {
+ if(!usbd_core_cfg.ep0_data_buf_residue && (len > usbd_core_cfg.ep0_data_buf_len) && !(usbd_core_cfg.ep0_data_buf_len % USB_CTRL_EP_MPS)){
/* Transfers a zero-length packet next*/
usbd_core_cfg.zlp_flag = true;
}