From 7f62c24532be56a680a9ff8ce13039874104b551 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 29 Nov 2017 00:24:28 +0100 Subject: [PATCH] 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. --- firmware/atmel_softpack_libraries/usb/device/core/USBD.c | 6 ++++++ .../atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/firmware/atmel_softpack_libraries/usb/device/core/USBD.c b/firmware/atmel_softpack_libraries/usb/device/core/USBD.c index 422c2754..bd39a53f 100644 --- a/firmware/atmel_softpack_libraries/usb/device/core/USBD.c +++ b/firmware/atmel_softpack_libraries/usb/device/core/USBD.c @@ -47,6 +47,8 @@ #include "USBD.h" #include "USBD_HAL.h" +extern void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request); + /*--------------------------------------------------------------------------- * Definitions *---------------------------------------------------------------------------*/ @@ -144,7 +146,11 @@ void USBD_RequestHandler(uint8_t bEndpoint, bEndpoint); } else { +#if defined(BOARD_USB_DFU) && !defined(APPLICATION_dfu) + USBDFU_Runtime_RequestHandler(pRequest); +#else USBDCallbacks_RequestReceived(pRequest); +#endif } } diff --git a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c index 4d8330f4..177a7407 100644 --- a/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c +++ b/firmware/atmel_softpack_libraries/usb/device/dfu/dfu_runtime.c @@ -141,7 +141,7 @@ void USBDFU_Runtime_RequestHandler(const USBGenericRequest *request) if (USBGenericRequest_GetType(request) != USBGenericRequest_CLASS || USBGenericRequest_GetRecipient(request) != USBGenericRequest_INTERFACE) { TRACE_DEBUG("std_ho_usbd "); - USBDDriver_RequestHandler(usbdDriver, request); + USBDCallbacks_RequestReceived(request); return; } @@ -216,9 +216,3 @@ void DFURT_SwitchToDFU(void) * ResetVector of the bootloader */ NVIC_SystemReset(); } - -void USBDCallbacks_RequestReceived(const USBGenericRequest *request) -{ - /* FIXME: integration with CCID control point reqeusts */ - USBDFU_Runtime_RequestHandler(request); -}