summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorsakimisu <[email protected]>2023-06-06 22:22:46 +0800
committersakimisu <[email protected]>2023-06-06 22:22:46 +0800
commit85a494326a45550e27fadd6aced0691e38aa4aba (patch)
tree3da92b76b11af8e3959d9202434d23fdba1f6c09 /core
parentccf97b35e37baf0ec689ee4dfe4f4fd0215d5d9a (diff)
check intf num when arg is validv0.9.0
Diffstat (limited to 'core')
-rw-r--r--core/usbd_core.c11
1 files 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);
+ }
}
}
}