Skip to content

Commit 85a4943

Browse files
committed
check intf num when arg is valid
1 parent ccf97b3 commit 85a4943

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/usbd_core.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,15 @@ static void usbd_class_event_notify_handler(uint8_t event, void *arg)
950950
{
951951
struct usbd_interface *intf = usb_slist_entry(i, struct usbd_interface, list);
952952

953-
if (intf->notify_handler) {
954-
intf->notify_handler(event, arg);
953+
if (arg) {
954+
struct usb_interface_descriptor *desc = (struct usb_interface_descriptor *)arg;
955+
if (intf->notify_handler && (desc->bInterfaceNumber == (intf->intf_num))) {
956+
intf->notify_handler(event, arg);
957+
}
958+
} else {
959+
if (intf->notify_handler) {
960+
intf->notify_handler(event, arg);
961+
}
955962
}
956963
}
957964
}

0 commit comments

Comments
 (0)