usb: Allow Audio Class to handle custom_hander for all interfaces

This exception allows USB Audio Class to properly respond to the
interface requests.

This commit is temporary solution and shall not be considered as
valid solution for other classes.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
This commit is contained in:
Emil Obalski 2020-05-06 15:39:04 +02:00 committed by Carles Cufí
parent 04d1104ee5
commit 8fa51bca58
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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);
}
}