USB: Handle DFU requests by USBD.c to keep application callback

e.g. in CCID mode we need to treat class-specific control requests,
and we want to do this in a way how the CCID code doesn't need to
understand about DFU.
This commit is contained in:
Harald Welte
2017-11-29 00:24:28 +01:00
parent 75cf93e04d
commit 7f62c24532
2 changed files with 7 additions and 7 deletions

View File

@@ -47,6 +47,8 @@
#include "USBD.h" #include "USBD.h"
#include "USBD_HAL.h" #include "USBD_HAL.h"
extern void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request);
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
* Definitions * Definitions
*---------------------------------------------------------------------------*/ *---------------------------------------------------------------------------*/
@@ -144,7 +146,11 @@ void USBD_RequestHandler(uint8_t bEndpoint,
bEndpoint); bEndpoint);
} }
else { else {
#if defined(BOARD_USB_DFU) && !defined(APPLICATION_dfu)
USBDFU_Runtime_RequestHandler(pRequest);
#else
USBDCallbacks_RequestReceived(pRequest); USBDCallbacks_RequestReceived(pRequest);
#endif
} }
} }

View File

@@ -141,7 +141,7 @@ void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request)
if (USBGenericRequest_GetType(request) != USBGenericRequest_CLASS || if (USBGenericRequest_GetType(request) != USBGenericRequest_CLASS ||
USBGenericRequest_GetRecipient(request) != USBGenericRequest_INTERFACE) { USBGenericRequest_GetRecipient(request) != USBGenericRequest_INTERFACE) {
TRACE_DEBUG("std_ho_usbd "); TRACE_DEBUG("std_ho_usbd ");
USBDDriver_RequestHandler(usbdDriver, request); USBDCallbacks_RequestReceived(request);
return; return;
} }
@@ -216,9 +216,3 @@ void DFURT_SwitchToDFU(void)
* ResetVector of the bootloader */ * ResetVector of the bootloader */
NVIC_SystemReset(); NVIC_SystemReset();
} }
void USBDCallbacks_RequestReceived(const USBGenericRequest *request)
{
/* FIXME: integration with CCID control point reqeusts */
USBDFU_Runtime_RequestHandler(request);
}