diff --git a/include/usb/usb_common.h b/include/usb/usb_common.h index c3c0058e2ef..1e7c7a02525 100644 --- a/include/usb/usb_common.h +++ b/include/usb/usb_common.h @@ -104,6 +104,7 @@ (USB_CONFIGURATION_ATTRIBUTES_REMOTE_WAKEUP), (0)))) /* Classes */ +#define AUDIO_CLASS 0x01 #define COMMUNICATION_DEVICE_CLASS 0x02 #define COMMUNICATION_DEVICE_CLASS_DATA 0x0A #define HID_CLASS 0x03 diff --git a/subsys/usb/usb_device.c b/subsys/usb/usb_device.c index a04962bc2da..d42b2d37c6d 100644 --- a/subsys/usb/usb_device.c +++ b/subsys/usb/usb_device.c @@ -1244,9 +1244,13 @@ static int custom_handler(struct usb_setup_packet *pSetup, continue; } - if ((iface->custom_handler) && + /* An exception for AUDIO_CLASS is temporary and shall not be + * considered as valid solution for other classes. + */ + if (iface->custom_handler && (if_descr->bInterfaceNumber == - sys_le16_to_cpu(pSetup->wIndex))) { + sys_le16_to_cpu(pSetup->wIndex) || + if_descr->bInterfaceClass == AUDIO_CLASS)) { return iface->custom_handler(pSetup, len, data); } }