Skip to content

Commit

Permalink
check intf num when arg is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
sakumisu committed Jun 6, 2023
1 parent ccf97b3 commit 85a4943
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions core/usbd_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 85a4943

Please sign in to comment.