From 8f208fd0c05b6eef411fe897c1246b27d12680f8 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Fri, 1 Mar 2024 14:34:28 +0800 Subject: [PATCH] fix(usb): Fix bug where usbh_process() misses an event This commit fixes a bug where if multiple concurrent USBH API calls trigger multiple events on the same device, some events will be lost. As a result, those lost events don't get processed by the subsequent usbh_process() call. --- components/usb/usbh.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/usb/usbh.c b/components/usb/usbh.c index 7694287019..05f698385f 100644 --- a/components/usb/usbh.c +++ b/components/usb/usbh.c @@ -207,6 +207,8 @@ static bool _dev_set_actions(device_t *dev_obj, uint32_t action_flags) dev_obj->dynamic.flags.in_pending_list = 1; call_notif_cb = true; } else { + // The device is already on the callback list, thus a processing request is already pending. + dev_obj->dynamic.action_flags |= action_flags; call_notif_cb = false; } return call_notif_cb;