From c75203f41d1a5bde8eb4aff2659250f18e7a7895 Mon Sep 17 00:00:00 2001 From: "chao.gong@smartic.ai" Date: Wed, 15 Feb 2023 15:21:24 +0800 Subject: [PATCH 1/2] check if urb is NULL --- port/musb/usb_hc_musb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/port/musb/usb_hc_musb.c b/port/musb/usb_hc_musb.c index d55dc561..51f47400 100644 --- a/port/musb/usb_hc_musb.c +++ b/port/musb/usb_hc_musb.c @@ -921,6 +921,7 @@ void USBH_IRQHandler(void) pipe = &g_musb_hcd.pipe_pool[ep_idx][0]; urb = pipe->urb; + if (urb == NULL) continue; musb_set_active_ep(ep_idx); ep_csrl_status = HWREGB(USB_BASE + MUSB_IND_TXCSRL_OFFSET); -- Gitee From 99d8daeaa260a960922633d2b182e6a73047871f Mon Sep 17 00:00:00 2001 From: "chao.gong@smartic.ai" Date: Wed, 15 Feb 2023 15:23:52 +0800 Subject: [PATCH 2/2] cancel notify broadcast when Specify recipient --- core/usbd_core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/usbd_core.c b/core/usbd_core.c index e2ced33c..7eb63499 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -939,8 +939,18 @@ static void usbd_class_event_notify_handler(uint8_t event, void *arg) { struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list); - if (intf->notify_handler) { - intf->notify_handler(event, arg); + if (arg == NULL) { + if (intf->notify_handler) { + intf->notify_handler(event, arg); + } + } + else { + struct usb_interface_descriptor *intf_arg = (struct usb_interface_descriptor *)arg; + if (intf->intf_num == intf_arg->bInterfaceNumber) { + if (intf->notify_handler) { + intf->notify_handler(event, arg); + } + } } } } -- Gitee