From 85a494326a45550e27fadd6aced0691e38aa4aba Mon Sep 17 00:00:00 2001 From: sakimisu <1203593632@qq.com> Date: Tue, 6 Jun 2023 22:22:46 +0800 Subject: [PATCH] check intf num when arg is valid --- core/usbd_core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/core/usbd_core.c b/core/usbd_core.c index 48723df9..9fc05ec2 100644 --- a/core/usbd_core.c +++ b/core/usbd_core.c @@ -950,8 +950,15 @@ 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) { + struct usb_interface_descriptor *desc = (struct usb_interface_descriptor *)arg; + if (intf->notify_handler && (desc->bInterfaceNumber == (intf->intf_num))) { + intf->notify_handler(event, arg); + } + } else { + if (intf->notify_handler) { + intf->notify_handler(event, arg); + } } } }