From 2789633b50d0b9d511a1adf3e7770500dbc31b71 Mon Sep 17 00:00:00 2001 From: heyuanjie87 Date: Fri, 11 Aug 2023 17:44:36 +0800 Subject: [hub 修正] 快速断开的情况下无法处理断开事件 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/hub/usbh_hub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/class/hub/usbh_hub.c b/class/hub/usbh_hub.c index 7c4ec7ba..2a124386 100644 --- a/class/hub/usbh_hub.c +++ b/class/hub/usbh_hub.c @@ -460,9 +460,10 @@ static void usbh_hub_events(struct usbh_hub *hub) return; } - for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { - portchange_index = hub->int_buffer[0]; + portchange_index = hub->int_buffer[0]; + hub->int_buffer[0] = 0; + for (uint8_t port = 0; port < hub->hub_desc.bNbrPorts; port++) { USB_LOG_DBG("Port change:0x%02x\r\n", portchange_index); if (!(portchange_index & (1 << (port + 1)))) { @@ -625,7 +626,6 @@ static void usbh_hub_events(struct usbh_hub *hub) } } - hub->int_buffer[0] = 0; /* Start next hub int transfer */ if (!hub->is_roothub && hub->connected) { usbh_submit_urb(&hub->intin_urb); -- cgit v1.3.1