From ba3fceeb8703a68aefef01a00042b5aa07e4b9a7 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Thu, 17 Feb 2022 13:32:53 +0800 Subject: fix ep0 zlp send judgement --- core/usbd_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- cgit v1.3.1