From 81bd8f2f83c0878f2f3ab3cdd73f284a1656c341 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 11 Feb 2012 20:39:33 +0000 Subject: Clean up the Audio Device class driver control request Endpoint match logic. --- LUFA/Drivers/USB/Class/Device/AudioClassDevice.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'LUFA/Drivers/USB') diff --git a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c index 1bf1df458..1e91a6134 100644 --- a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c @@ -49,16 +49,13 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi } else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) { - bool EndpointFilterMatch = false; - - EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataINEndpointNumber && - ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber))); - - EndpointFilterMatch |= (AudioInterfaceInfo->Config.DataOUTEndpointNumber && - ((uint8_t)USB_ControlRequest.wIndex == (ENDPOINT_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber))); - - if (!(EndpointFilterMatch)) - return; + uint8_t EndpointIndex = (USB_ControlRequest.wIndex & 0xFF); + + if ((EndpointIndex != (ENDPOINT_DIR_IN | AudioInterfaceInfo->Config.DataINEndpointNumber)) && + (EndpointIndex != (ENDPOINT_DIR_OUT | AudioInterfaceInfo->Config.DataOUTEndpointNumber))) + { + return; + } } switch (USB_ControlRequest.bRequest) -- cgit v1.2.3