From 2d5e863fe14c4e4043b21330ca2cda2c8a158408 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:24:52 -0500 Subject: [PATCH 001/104] Fixed race condition when multiple SETUP messages queued. When USB_Device_ProcessControlRequest() is called, it first does the HID-specific EVENT_USB_Device_ControlRequest() processing. If that doesn't handle the request, then since Endpoint_isSETUPReceived() is still true, then to do the generic processing. If _that_ doesn't handle the request, then it calls Endpoint_ClearSETUP() and stalls the transaction. In some cases, a new SETUP message is arriving between the Endpoint_ClearSETUP() in EVENT_USB_Device_ControlRequest() and the check for Endpoint_isSETUPReceived() right after EVENT_USB_Device_ControlRequest() returns. In this case, the switch statement in USB_Device_ProcessControlRequest() tries to process the HID-specific message with the generic processing. It doesn't handle the HID-specific message, so it falls through to the STALL code. My suggestion is to only check for Endpoint_isSETUPReceived() once at the top of USB_Device_ProcessControlRequest(). If it is set, then try first the specific handler, then if that doesn't satisfy the request, then try the generic handler. If _that_ doesn't handle the request, then generate the STALL. I did this by using a request_handled variable, and modifying EVENT_USB_Device_ControlRequest() to return a value that says whether it handled the request or not. --- LUFA/Drivers/USB/Core/DeviceStandardReq.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/LUFA/Drivers/USB/Core/DeviceStandardReq.c index a730711e6..b490c4145 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -48,6 +48,8 @@ bool USB_Device_RemoteWakeupEnabled; void USB_Device_ProcessControlRequest(void) { + int request_handled; + #if defined(ARCH_BIG_ENDIAN) USB_ControlRequest.bmRequestType = Endpoint_Read_8(); USB_ControlRequest.bRequest = Endpoint_Read_8(); @@ -63,7 +65,14 @@ void USB_Device_ProcessControlRequest(void) EVENT_USB_Device_ControlRequest(); - if (Endpoint_IsSETUPReceived()) + if (!Endpoint_IsSETUPReceived()) + { + return; + } + + request_handled = EVENT_USB_Device_ControlRequest(); + + if (!request_handled) { uint8_t bmRequestType = USB_ControlRequest.bmRequestType; @@ -74,6 +83,7 @@ void USB_Device_ProcessControlRequest(void) (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_ENDPOINT))) { USB_Device_GetStatus(); + request_handled = 1; } break; @@ -83,12 +93,14 @@ void USB_Device_ProcessControlRequest(void) (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_ENDPOINT))) { USB_Device_ClearSetFeature(); + request_handled = 1; } break; case REQ_SetAddress: if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) USB_Device_SetAddress(); + request_handled = 1; break; case REQ_GetDescriptor: @@ -96,27 +108,30 @@ void USB_Device_ProcessControlRequest(void) (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_INTERFACE))) { USB_Device_GetDescriptor(); + request_handled = 1; } break; case REQ_GetConfiguration: if (bmRequestType == (REQDIR_DEVICETOHOST | REQTYPE_STANDARD | REQREC_DEVICE)) USB_Device_GetConfiguration(); + request_handled = 1; break; case REQ_SetConfiguration: if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_DEVICE)) USB_Device_SetConfiguration(); + request_handled = 1; break; default: break; } + } - - if (Endpoint_IsSETUPReceived()) - { + + if (!request_handled) Endpoint_ClearSETUP(); Endpoint_StallTransaction(); } From 6cca2600ae4d03e447d36ae133309231775af02c Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:28:52 -0500 Subject: [PATCH 002/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/HID/BootloaderHID.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Bootloaders/HID/BootloaderHID.c b/Bootloaders/HID/BootloaderHID.c index bdff1eda3..1de96f555 100644 --- a/Bootloaders/HID/BootloaderHID.c +++ b/Bootloaders/HID/BootloaderHID.c @@ -119,13 +119,13 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Ignore any requests that aren't directed to the HID interface */ if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != (REQTYPE_CLASS | REQREC_INTERFACE)) { - return; + return 0; } /* Process HID specific control requests */ @@ -184,7 +184,10 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearOUT(); Endpoint_ClearStatusStage(); + return 1; break; } + + return 0; } From e33bcc877da5f2d8a90454366a5bdb21d00fb5ba Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:30:19 -0500 Subject: [PATCH 003/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/GenericHID/GenericHID.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.c b/Demos/Device/ClassDriver/GenericHID/GenericHID.c index 661a745c7..713752a8c 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.c +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.c @@ -129,9 +129,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Generic_HID_Interface); + return HID_Device_ProcessControlRequest(&Generic_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From 0d8fa2299fb71bf405cf4e48d705dc16fc5ef3db Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:31:03 -0500 Subject: [PATCH 004/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/GenericHID/GenericHID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/GenericHID/GenericHID.h b/Demos/Device/ClassDriver/GenericHID/GenericHID.h index c710d0a8e..c1720262b 100644 --- a/Demos/Device/ClassDriver/GenericHID/GenericHID.h +++ b/Demos/Device/ClassDriver/GenericHID/GenericHID.h @@ -69,7 +69,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From 60daba660588abb1bad84c553143d0ebf4cfc16c Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:32:27 -0500 Subject: [PATCH 005/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/GenericHID/GenericHID.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.c b/Demos/Device/LowLevel/GenericHID/GenericHID.c index 87e88e470..8657d0212 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.c +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.c @@ -118,7 +118,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -135,7 +135,8 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_Write_Control_Stream_LE(&GenericData, sizeof(GenericData)); Endpoint_ClearOUT(); } - + + return 1; break; case HID_REQ_SetReport: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) @@ -151,8 +152,10 @@ void EVENT_USB_Device_ControlRequest(void) ProcessGenericHIDReport(GenericData); } + return 1; break; } + return 0; } /** Function to process the last received report from the host. From ccd8c68b243806e9288fd44db5463ddb24d4f2f9 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:32:51 -0500 Subject: [PATCH 006/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/GenericHID/GenericHID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/GenericHID/GenericHID.h b/Demos/Device/LowLevel/GenericHID/GenericHID.h index 6b43d943c..146de162d 100644 --- a/Demos/Device/LowLevel/GenericHID/GenericHID.h +++ b/Demos/Device/LowLevel/GenericHID/GenericHID.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); void ProcessGenericHIDReport(uint8_t* DataArray); From 82a63cdea9ec714f93b5812c15b180714c4324f2 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:36:22 -0500 Subject: [PATCH 007/104] Added return code to HID_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/HIDClassDevice.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c index e95575876..78ab86cee 100644 --- a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c @@ -37,13 +37,13 @@ #define __INCLUDE_FROM_HID_DEVICE_C #include "HIDClassDevice.h" -void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) +int HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber) - return; + return 0; switch (USB_ControlRequest.bRequest) { @@ -74,6 +74,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_Write_Control_Stream_LE(ReportData, ReportSize); Endpoint_ClearOUT(); + return 1; } break; @@ -91,6 +92,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportType, &ReportData[ReportID ? 1 : 0], ReportSize - (ReportID ? 1 : 0)); + return 1; } break; @@ -102,6 +104,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_Write_8(HIDInterfaceInfo->State.UsingReportProtocol); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -112,6 +115,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_ClearStatusStage(); HIDInterfaceInfo->State.UsingReportProtocol = ((USB_ControlRequest.wValue & 0xFF) != 0x00); + return 1; } break; @@ -122,6 +126,7 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_ClearStatusStage(); HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6); + return 1; } break; @@ -133,10 +138,12 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter Endpoint_Write_8(HIDInterfaceInfo->State.IdleCount >> 2); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) From 4311cd1a77c8671519ec28889587fbe7456375a7 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:36:58 -0500 Subject: [PATCH 008/104] Added return code to HID_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/HIDClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h index 4a9b4aecd..d9256c5d9 100644 --- a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.h @@ -136,7 +136,7 @@ * * \param[in,out] HIDInterfaceInfo Pointer to a structure containing a HID Class configuration and state. */ - void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** General management task for a given HID class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). From 1345baaf8134bea73860c98f25f5b21f22ea9871 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:38:48 -0500 Subject: [PATCH 009/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Joystick/Joystick.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.c b/Demos/Device/ClassDriver/Joystick/Joystick.c index b05ffcb52..816f7cb80 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.c +++ b/Demos/Device/ClassDriver/Joystick/Joystick.c @@ -131,9 +131,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Joystick_HID_Interface); + return HID_Device_ProcessControlRequest(&Joystick_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From 1cf4f49f4d5e88c4ddda376f64f31ab6cb1ef3bb Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:39:22 -0500 Subject: [PATCH 010/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Joystick/Joystick.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/Joystick/Joystick.h b/Demos/Device/ClassDriver/Joystick/Joystick.h index 7bd04d5f1..c74c54455 100644 --- a/Demos/Device/ClassDriver/Joystick/Joystick.h +++ b/Demos/Device/ClassDriver/Joystick/Joystick.h @@ -82,7 +82,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From f66b80c8d7d2a5433d5ebf37e0d5446ff6953bdd Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:40:09 -0500 Subject: [PATCH 011/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Keyboard/Keyboard.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.c b/Demos/Device/ClassDriver/Keyboard/Keyboard.c index 7c53a8f68..5f8189a9b 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.c +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.c @@ -131,9 +131,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + return HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From 6af643cf22c027aacbe8bb16e48c2ce863b5b0f3 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:40:41 -0500 Subject: [PATCH 012/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Keyboard/Keyboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/Keyboard/Keyboard.h b/Demos/Device/ClassDriver/Keyboard/Keyboard.h index 80999f905..421f404a6 100644 --- a/Demos/Device/ClassDriver/Keyboard/Keyboard.h +++ b/Demos/Device/ClassDriver/Keyboard/Keyboard.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From c4489459171612a9ce3f1b6662d60d98e2f0c35a Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:42:43 -0500 Subject: [PATCH 013/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../Device/ClassDriver/KeyboardMouse/KeyboardMouse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c index e81d0fb9a..9a856be53 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.c @@ -157,10 +157,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); - HID_Device_ProcessControlRequest(&Mouse_HID_Interface); + int request_handled; + + request_handled = HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + if (!request_handled) { + request_handled = HID_Device_ProcessControlRequest(&Mouse_HID_Interface); + } + + return request_handled; } /** Event handler for the USB device Start Of Frame event. */ From c0aafaad5e3a69e0d232c303bbcb34f86a5f8b83 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:43:10 -0500 Subject: [PATCH 014/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h index 87b31efd3..981ea07f5 100644 --- a/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/ClassDriver/KeyboardMouse/KeyboardMouse.h @@ -66,7 +66,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From 60ae0ae90081136a4f8c8e8432bf622fedefcaab Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:43:46 -0500 Subject: [PATCH 015/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../KeyboardMouseMultiReport/KeyboardMouseMultiReport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c index a56fb37c4..6304ead21 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.c @@ -130,9 +130,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Device_HID_Interface); + return HID_Device_ProcessControlRequest(&Device_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From 9b8180e92a6743030b47cc65878aa4821a39c2b9 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:44:15 -0500 Subject: [PATCH 016/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../KeyboardMouseMultiReport/KeyboardMouseMultiReport.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h index 87b31efd3..981ea07f5 100644 --- a/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h +++ b/Demos/Device/ClassDriver/KeyboardMouseMultiReport/KeyboardMouseMultiReport.h @@ -66,7 +66,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From 6fbef156802f571fcaf920345dc58d909e5e5339 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:46:14 -0500 Subject: [PATCH 017/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../MassStorageKeyboard/MassStorageKeyboard.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c index 0a622c194..fd8fa1983 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.c @@ -169,10 +169,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MS_Device_ProcessControlRequest(&Disk_MS_Interface); - HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + int request_handled; + + request_handled = MS_Device_ProcessControlRequest(&Disk_MS_Interface); + if (!request_handled) { + request_handled = HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + } + + return request_handled; } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. From 61b87613adf85c3575cb7bd77841fbdfc6e351b2 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:46:38 -0500 Subject: [PATCH 018/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h index e3a24be68..887a7da44 100644 --- a/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h +++ b/Demos/Device/ClassDriver/MassStorageKeyboard/MassStorageKeyboard.h @@ -80,7 +80,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); From a9cdcff9407e621fa1ef7b4ff46bfcb3a3cd40e7 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:47:09 -0500 Subject: [PATCH 019/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Mouse/Mouse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.c b/Demos/Device/ClassDriver/Mouse/Mouse.c index 91ae8e15e..3a00fa731 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.c +++ b/Demos/Device/ClassDriver/Mouse/Mouse.c @@ -131,9 +131,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Mouse_HID_Interface); + return HID_Device_ProcessControlRequest(&Mouse_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From ae1c6d3ec3c2abaebe06b798b5903331b985b4cc Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:47:26 -0500 Subject: [PATCH 020/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/Mouse/Mouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/Mouse/Mouse.h b/Demos/Device/ClassDriver/Mouse/Mouse.h index e6ec70584..09dcb9c6b 100644 --- a/Demos/Device/ClassDriver/Mouse/Mouse.h +++ b/Demos/Device/ClassDriver/Mouse/Mouse.h @@ -72,7 +72,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From 35aecf22435533969ba24fe3fa6dfd28a18516d6 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:48:40 -0500 Subject: [PATCH 021/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../VirtualSerialMouse/VirtualSerialMouse.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c index cae378973..ddda368c4 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.c @@ -195,10 +195,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); - HID_Device_ProcessControlRequest(&Mouse_HID_Interface); + int request_handled; + + request_handled = CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + if (!request_handled) { + request_handled = HID_Device_ProcessControlRequest(&Mouse_HID_Interface); + } + + return request_handled; } /** Event handler for the USB device Start Of Frame event. */ From 22b91e8be0eed451d54cbb05888e887d7ba83ac4 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:48:58 -0500 Subject: [PATCH 022/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h index 0aebce1cd..66d8a4316 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h +++ b/Demos/Device/ClassDriver/VirtualSerialMouse/VirtualSerialMouse.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From faf1ccd2c0923111600724217a218cadcd1292f3 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:49:41 -0500 Subject: [PATCH 023/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c index 5c3429351..a14978936 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.c @@ -84,9 +84,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Mouse_HID_Device_Interface); + return HID_Device_ProcessControlRequest(&Mouse_HID_Device_Interface); } /** Event handler for the USB device Start Of Frame event. */ From b5fdad930d2b98b45bb44b9db681988e77a7ce9a Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:49:58 -0500 Subject: [PATCH 024/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h index 72c2a2012..d0f5f384d 100644 --- a/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h +++ b/Demos/DualRole/ClassDriver/MouseHostDevice/DeviceFunctions.h @@ -57,7 +57,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); #endif From 44dfe57e87c4485d312a4b0a5c08a438d5f75ef0 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:51:14 -0500 Subject: [PATCH 025/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Magstripe/Magstripe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/Magstripe/Magstripe.c b/Projects/Magstripe/Magstripe.c index 8eecf9b01..fbd027767 100644 --- a/Projects/Magstripe/Magstripe.c +++ b/Projects/Magstripe/Magstripe.c @@ -154,9 +154,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); + return HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From c9d03d1029b546a861ac6b74838612a509e7fb5b Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:51:40 -0500 Subject: [PATCH 026/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Magstripe/Magstripe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Magstripe/Magstripe.h b/Projects/Magstripe/Magstripe.h index dc5edf5ad..a480b59b6 100644 --- a/Projects/Magstripe/Magstripe.h +++ b/Projects/Magstripe/Magstripe.h @@ -72,7 +72,7 @@ void ReadMagstripeData(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From cc659316fdc4b0aec6c8acf27e5f14b571a0a0ce Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:52:10 -0500 Subject: [PATCH 027/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/MediaController/MediaController.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/MediaController/MediaController.c b/Projects/MediaController/MediaController.c index 55384b472..bad240ce1 100644 --- a/Projects/MediaController/MediaController.c +++ b/Projects/MediaController/MediaController.c @@ -121,9 +121,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - HID_Device_ProcessControlRequest(&MediaControl_HID_Interface); + return HID_Device_ProcessControlRequest(&MediaControl_HID_Interface); } /** Event handler for the USB device Start Of Frame event. */ From cb102397668f351cd33919959173d9aa58e826e5 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:52:27 -0500 Subject: [PATCH 028/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/MediaController/MediaController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/MediaController/MediaController.h b/Projects/MediaController/MediaController.h index 9ee349ed9..e61a543cb 100644 --- a/Projects/MediaController/MediaController.h +++ b/Projects/MediaController/MediaController.h @@ -92,7 +92,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From 3c67b0867f7a9ed63bf61847b4291f01c6722697 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:53:31 -0500 Subject: [PATCH 029/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/TempDataLogger/TempDataLogger.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Projects/TempDataLogger/TempDataLogger.c b/Projects/TempDataLogger/TempDataLogger.c index eb1a2fc2d..cf08ea3f7 100644 --- a/Projects/TempDataLogger/TempDataLogger.c +++ b/Projects/TempDataLogger/TempDataLogger.c @@ -256,10 +256,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MS_Device_ProcessControlRequest(&Disk_MS_Interface); - HID_Device_ProcessControlRequest(&Generic_HID_Interface); + int request_handled; + + request_handled = MS_Device_ProcessControlRequest(&Disk_MS_Interface); + if (!request_handled) { + request_handled = HID_Device_ProcessControlRequest(&Generic_HID_Interface); + } + + return request_handled; } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. From b6791edf6011643c08429387800ffee4ced7042c Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:53:50 -0500 Subject: [PATCH 030/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/TempDataLogger/TempDataLogger.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/TempDataLogger/TempDataLogger.h b/Projects/TempDataLogger/TempDataLogger.h index 2bfbc413f..56b6c246c 100644 --- a/Projects/TempDataLogger/TempDataLogger.h +++ b/Projects/TempDataLogger/TempDataLogger.h @@ -94,7 +94,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, From d77337886e9738998a464f64b6e09209d5a5538b Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:55:10 -0500 Subject: [PATCH 031/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/MassStorage/BootloaderMassStorage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootloaders/MassStorage/BootloaderMassStorage.c b/Bootloaders/MassStorage/BootloaderMassStorage.c index 776e6b738..438286363 100644 --- a/Bootloaders/MassStorage/BootloaderMassStorage.c +++ b/Bootloaders/MassStorage/BootloaderMassStorage.c @@ -239,9 +239,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MS_Device_ProcessControlRequest(&Disk_MS_Interface); + return MS_Device_ProcessControlRequest(&Disk_MS_Interface); } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. From 3c41f74d7cdf7dff59dd4d16379e426984132e58 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:55:44 -0500 Subject: [PATCH 032/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/MassStorage/BootloaderMassStorage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootloaders/MassStorage/BootloaderMassStorage.h b/Bootloaders/MassStorage/BootloaderMassStorage.h index fc084dc94..afd37fc3d 100644 --- a/Bootloaders/MassStorage/BootloaderMassStorage.h +++ b/Bootloaders/MassStorage/BootloaderMassStorage.h @@ -87,7 +87,7 @@ void EVENT_USB_Device_Connect(void) AUX_BOOT_SECTION; void EVENT_USB_Device_Disconnect(void) AUX_BOOT_SECTION; void EVENT_USB_Device_ConfigurationChanged(void) AUX_BOOT_SECTION; - void EVENT_USB_Device_ControlRequest(void) AUX_BOOT_SECTION; + int EVENT_USB_Device_ControlRequest(void) AUX_BOOT_SECTION; bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) AUX_BOOT_SECTION; From 96ccfb6eb258b9f23a2fc7eb3dcf14a72cb79373 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:57:17 -0500 Subject: [PATCH 033/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../VirtualSerialMassStorage.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c index 6c3da2970..9c6d304b5 100644 --- a/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c +++ b/Demos/Device/ClassDriver/VirtualSerialMassStorage/VirtualSerialMassStorage.c @@ -218,10 +218,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); - MS_Device_ProcessControlRequest(&Disk_MS_Interface); + int request_handled; + + request_handled = CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + if (!request_handled) { + request_handled = MS_Device_ProcessControlRequest(&Disk_MS_Interface); + } + + return request_handled; } /** CDC class driver callback function the processing of changes to the virtual From b85c8c56435fd8acf03de9dca192629b0e9800ce Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:58:33 -0500 Subject: [PATCH 034/104] Added return code to MS_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c b/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c index 50fe1b9a5..5216a95b7 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.c @@ -37,13 +37,13 @@ #define __INCLUDE_FROM_MASSSTORAGE_DEVICE_C #include "MassStorageClassDevice.h" -void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) +int MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if (USB_ControlRequest.wIndex != MSInterfaceInfo->Config.InterfaceNumber) - return; + return 0; switch (USB_ControlRequest.bRequest) { @@ -54,6 +54,7 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac Endpoint_ClearStatusStage(); MSInterfaceInfo->State.IsMassStoreReset = true; + return 1; } break; @@ -65,10 +66,12 @@ void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfac Endpoint_Write_8(MSInterfaceInfo->Config.TotalLUNs - 1); Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } bool MS_Device_ConfigureEndpoints(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) From f89b2d1ae5900e486f7384a76414f3288391c56b Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 08:59:12 -0500 Subject: [PATCH 035/104] Added return code to MS_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h b/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h index d3360e62c..ac55c7f9e 100644 --- a/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/MassStorageClassDevice.h @@ -120,7 +120,7 @@ * * \param[in,out] MSInterfaceInfo Pointer to a structure containing a Mass Storage Class configuration and state. */ - void MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int MS_Device_ProcessControlRequest(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** General management task for a given Mass Storage class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). From 94bdce45065b61618bf99cc1b788b6f29300be50 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:00:54 -0500 Subject: [PATCH 036/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Webserver/USBDeviceMode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Projects/Webserver/USBDeviceMode.c b/Projects/Webserver/USBDeviceMode.c index 7e1841d4d..eb058f5bd 100644 --- a/Projects/Webserver/USBDeviceMode.c +++ b/Projects/Webserver/USBDeviceMode.c @@ -139,10 +139,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface_Device); - MS_Device_ProcessControlRequest(&Disk_MS_Interface); + int request_handled; + + request_handled = RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface_Device); + if (!request_handled) { + request_handled = MS_Device_ProcessControlRequest(&Disk_MS_Interface); + } + + return request_handled; } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. From 2fe4c5addd431a2e9339f698c56766732499ad23 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:01:17 -0500 Subject: [PATCH 037/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Webserver/USBDeviceMode.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Webserver/USBDeviceMode.h b/Projects/Webserver/USBDeviceMode.h index 9676dc55a..0ef59c6ce 100644 --- a/Projects/Webserver/USBDeviceMode.h +++ b/Projects/Webserver/USBDeviceMode.h @@ -54,7 +54,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); From 13bf6a3568fbe64e9a9415444013aa7f862a42c9 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:03:40 -0500 Subject: [PATCH 038/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../DualVirtualSerial/DualVirtualSerial.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c index 746a00725..8bbb43866 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.c @@ -210,10 +210,16 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface); - CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface); + int request_handled; + + request_handled = CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface); + if (!request_handled) { + request_handled = CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface); + } + + return request_handled; } /** CDC class driver callback function the processing of changes to the virtual From c87ab9e29020c74504a47d598477ecf1afa18501 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:03:55 -0500 Subject: [PATCH 039/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h index acf0b2296..3ffdee979 100644 --- a/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h +++ b/Demos/Device/ClassDriver/DualVirtualSerial/DualVirtualSerial.h @@ -70,7 +70,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From c0a4fcea9a1be6192fec5a87708aae2aba60a44f Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:05:22 -0500 Subject: [PATCH 040/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c index 18070bc91..c1a08ad5e 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.c @@ -180,9 +180,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** CDC class driver callback function the processing of changes to the virtual From e808275e12a444abdd72ae429a9ffa68bd5b970f Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:05:41 -0500 Subject: [PATCH 041/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h index da2d7cf34..961605b2e 100644 --- a/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h +++ b/Demos/Device/ClassDriver/VirtualSerial/VirtualSerial.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 046f4c48544ee3f677950fda9072ae0d7d33c21e Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:08:36 -0500 Subject: [PATCH 042/104] Added return code to CDC_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/CDCClassDevice.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c index c366c2f5e..87e465410 100644 --- a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.c @@ -37,13 +37,13 @@ #define __INCLUDE_FROM_CDC_DEVICE_C #include "CDCClassDevice.h" -void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +int CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if (USB_ControlRequest.wIndex != CDCInterfaceInfo->Config.ControlInterfaceNumber) - return; + return 0; switch (USB_ControlRequest.bRequest) { @@ -61,6 +61,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -72,7 +73,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter while (!(Endpoint_IsOUTReceived())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; /* Or should this be considered "handled"? */ } CDCInterfaceInfo->State.LineEncoding.BaudRateBPS = Endpoint_Read_32_LE(); @@ -84,6 +85,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter Endpoint_ClearStatusStage(); EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); + return 1; } break; @@ -96,6 +98,7 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue; EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); + return 1; } break; @@ -106,10 +109,12 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter Endpoint_ClearStatusStage(); EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); + return 1; } break; } + return 0; } bool CDC_Device_ConfigureEndpoints(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) From 99d309ff913775797a07010362320ac496d86165 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:09:06 -0500 Subject: [PATCH 043/104] Added return code to CDC_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/CDCClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h index 1c88fb841..a8d6926de 100644 --- a/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/CDCClassDevice.h @@ -145,7 +145,7 @@ * * \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state. */ - void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** General management task for a given CDC class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). From 442ef9a99d274602d8a9ca0f5f2bb325beacb19d Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:09:47 -0500 Subject: [PATCH 044/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Benito/Benito.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c index 4329ef634..8dd6c70f5 100644 --- a/Projects/Benito/Benito.c +++ b/Projects/Benito/Benito.c @@ -224,9 +224,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** Event handler for the CDC Class driver Line Encoding Changed event. From 4965db45d9106c224f94be1f0d13a5b416e9a7f5 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:10:02 -0500 Subject: [PATCH 045/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/Benito/Benito.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h index 2c14fb550..18960c2b8 100644 --- a/Projects/Benito/Benito.h +++ b/Projects/Benito/Benito.h @@ -70,7 +70,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); From 021d21be3a409ca6b8caf534726c45f43f76fc12 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:10:30 -0500 Subject: [PATCH 046/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/LEDNotifier/LEDNotifier.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/LEDNotifier/LEDNotifier.c b/Projects/LEDNotifier/LEDNotifier.c index 8e70e90d4..5fb5204c9 100644 --- a/Projects/LEDNotifier/LEDNotifier.c +++ b/Projects/LEDNotifier/LEDNotifier.c @@ -171,8 +171,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } From 2a17eb926537c6042e63bccf68eb4a6768ed1057 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:10:44 -0500 Subject: [PATCH 047/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/LEDNotifier/LEDNotifier.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/LEDNotifier/LEDNotifier.h b/Projects/LEDNotifier/LEDNotifier.h index 274a0f06c..71e5927c7 100644 --- a/Projects/LEDNotifier/LEDNotifier.h +++ b/Projects/LEDNotifier/LEDNotifier.h @@ -54,7 +54,7 @@ void SetupHardware(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 8ab7b9a6b4b62125c4f0fd9256d5390dc5a6c057 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:11:13 -0500 Subject: [PATCH 048/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/SerialToLCD/SerialToLCD.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/SerialToLCD/SerialToLCD.c b/Projects/SerialToLCD/SerialToLCD.c index 007f3adb1..4a9862a34 100644 --- a/Projects/SerialToLCD/SerialToLCD.c +++ b/Projects/SerialToLCD/SerialToLCD.c @@ -164,7 +164,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } From 01558b63c68cf447137cb82263eec1d481eaa78a Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:11:28 -0500 Subject: [PATCH 049/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/SerialToLCD/SerialToLCD.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/SerialToLCD/SerialToLCD.h b/Projects/SerialToLCD/SerialToLCD.h index 4ea8b88ee..aa4f86d49 100644 --- a/Projects/SerialToLCD/SerialToLCD.h +++ b/Projects/SerialToLCD/SerialToLCD.h @@ -58,7 +58,7 @@ void SetupHardware(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 56c496beab6cd60c3fc59e72892a10480b9f4ea4 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:11:51 -0500 Subject: [PATCH 050/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/USBtoSerial/USBtoSerial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/USBtoSerial/USBtoSerial.c b/Projects/USBtoSerial/USBtoSerial.c index 266592b14..bf52355a7 100644 --- a/Projects/USBtoSerial/USBtoSerial.c +++ b/Projects/USBtoSerial/USBtoSerial.c @@ -182,9 +182,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); } /** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer From 684a782957b043fdd323dfb90f861b93cf39e0d3 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:12:05 -0500 Subject: [PATCH 051/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/USBtoSerial/USBtoSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/USBtoSerial/USBtoSerial.h b/Projects/USBtoSerial/USBtoSerial.h index 068822a56..85b41b5b4 100644 --- a/Projects/USBtoSerial/USBtoSerial.h +++ b/Projects/USBtoSerial/USBtoSerial.h @@ -69,7 +69,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); From 144fc6eba7c5a769f71e0018ceb5856a964214b0 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:13:07 -0500 Subject: [PATCH 052/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/XPLAINBridge/XPLAINBridge.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Projects/XPLAINBridge/XPLAINBridge.c b/Projects/XPLAINBridge/XPLAINBridge.c index 9475b1fd9..e0cf7b9a8 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.c +++ b/Projects/XPLAINBridge/XPLAINBridge.c @@ -239,10 +239,12 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { if (CurrentFirmwareMode == MODE_USART_BRIDGE) - CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + return CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); + + return 0; } /** Event handler for the library USB Connection event. */ From dee3a428ad08aca5fb56c010d858e8609eee5e63 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:13:26 -0500 Subject: [PATCH 053/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/XPLAINBridge/XPLAINBridge.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/XPLAINBridge/XPLAINBridge.h b/Projects/XPLAINBridge/XPLAINBridge.h index baed8b90f..5c7a24cf4 100644 --- a/Projects/XPLAINBridge/XPLAINBridge.h +++ b/Projects/XPLAINBridge/XPLAINBridge.h @@ -88,7 +88,7 @@ void UARTBridge_Task(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); From 93825a4576d3966fb08f98e342440745c79ed502 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:14:47 -0500 Subject: [PATCH 054/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c index 95e270c49..6d59b7148 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.c @@ -172,8 +172,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface); + return RNDIS_Device_ProcessControlRequest(&Ethernet_RNDIS_Interface); } From 1cb0ae0265d4d62aa08d760d476e9c8ecec5cb6e Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:15:03 -0500 Subject: [PATCH 055/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h index 0e952da3e..cc27ed426 100644 --- a/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/ClassDriver/RNDISEthernet/RNDISEthernet.h @@ -78,7 +78,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From bc42646f3ad250e92c1c4757ae5b9dd3fb2cf180 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:16:42 -0500 Subject: [PATCH 056/104] Added return code to RNDIS_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c index 0fb0982ca..a0656953b 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.c @@ -68,13 +68,13 @@ static const uint32_t PROGMEM AdapterSupportedOIDList[] = CPU_TO_LE32(OID_802_3_XMIT_MORE_COLLISIONS), }; -void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) +int RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if (USB_ControlRequest.wIndex != RNDISInterfaceInfo->Config.ControlInterfaceNumber) - return; + return 0; switch (USB_ControlRequest.bRequest) { @@ -86,6 +86,7 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI Endpoint_ClearIN(); RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo); + return 1; } break; @@ -105,10 +106,12 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI Endpoint_ClearOUT(); MessageHeader->MessageLength = CPU_TO_LE32(0); + return 1; } break; } + return 0; } bool RNDIS_Device_ConfigureEndpoints(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) From 2fbf8f5b72a27d679b7d6133c76cc1cd221fbbee Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 09:17:09 -0500 Subject: [PATCH 057/104] Added return code to RNDIS_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h index dbf51f435..b4a4320fe 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/RNDISClassDevice.h @@ -120,7 +120,7 @@ * * \param[in,out] RNDISInterfaceInfo Pointer to a structure containing a RNDIS Class configuration and state. */ - void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDISInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** General management task for a given RNDIS class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). From 3ca2c618997663ceb6b7639f189fadffa2bb2dcc Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 11:17:16 -0500 Subject: [PATCH 058/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/AudioInput/AudioInput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 7e7b919ce..45f776574 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -167,9 +167,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface); + return Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface); } /** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented From d3129db1388fc674dcf1a50299b9a717008e8ea7 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 11:17:48 -0500 Subject: [PATCH 059/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/AudioInput/AudioInput.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.h b/Demos/Device/ClassDriver/AudioInput/AudioInput.h index dee883e43..626a480b5 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.h +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.h @@ -76,7 +76,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); bool CALLBACK_Audio_Device_GetSetEndpointProperty(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo, const uint8_t EndpointProperty, From 02fdff09640ea9a1f7402421aa9d24f88cda3de9 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 11:18:19 -0500 Subject: [PATCH 060/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/AudioOutput/AudioOutput.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c index fb5c1bd13..8c1986009 100644 --- a/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c +++ b/Demos/Device/ClassDriver/AudioOutput/AudioOutput.c @@ -204,9 +204,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface); + return Audio_Device_ProcessControlRequest(&Speaker_Audio_Interface); } /** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented From 1bed5ca57611dfe7c28776f63cd0ac82087f4743 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 11:20:38 -0500 Subject: [PATCH 061/104] Adding return code to Audio_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/AudioClassDevice.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c index 1c78750b9..669495732 100644 --- a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.c @@ -37,10 +37,10 @@ #define __INCLUDE_FROM_AUDIO_DEVICE_C #include "AudioClassDevice.h" -void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) +int Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) { @@ -49,7 +49,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi if ((InterfaceIndex != AudioInterfaceInfo->Config.ControlInterfaceNumber) && (InterfaceIndex != AudioInterfaceInfo->Config.StreamingInterfaceNumber)) { - return; + return 0; } } else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_ENDPOINT) @@ -59,7 +59,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi if ((EndpointAddress != AudioInterfaceInfo->Config.DataINEndpoint.Address) && (EndpointAddress != AudioInterfaceInfo->Config.DataOUTEndpoint.Address)) { - return; + return 0; } } @@ -73,6 +73,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi AudioInterfaceInfo->State.InterfaceEnabled = ((USB_ControlRequest.wValue & 0xFF) != 0); EVENT_Audio_Device_StreamStartStop(AudioInterfaceInfo); + return 1; } break; @@ -82,6 +83,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -107,6 +109,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi CALLBACK_Audio_Device_GetSetEndpointProperty(AudioInterfaceInfo, EndpointProperty, EndpointAddress, EndpointControl, &ValueLength, Value); + return 1; } } else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) @@ -127,6 +130,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi CALLBACK_Audio_Device_GetSetInterfaceProperty(AudioInterfaceInfo, Property, Entity, Parameter, &ValueLength, Value); + return 1; } } @@ -149,6 +153,7 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(Value, ValueLength); Endpoint_ClearOUT(); + return 1; } } else if ((USB_ControlRequest.bmRequestType & CONTROL_REQTYPE_RECIPIENT) == REQREC_INTERFACE) @@ -165,11 +170,13 @@ void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const Audi Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(Value, ValueLength); Endpoint_ClearOUT(); + return 1; } } break; } + return 0; } bool Audio_Device_ConfigureEndpoints(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) From e5c2d4ff9b62904ffc27e7e051169e7ebf2f735f Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 11:21:09 -0500 Subject: [PATCH 062/104] Adding return code to Audio_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/AudioClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h index 61d9b4c2b..16df5d9ab 100644 --- a/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/AudioClassDevice.h @@ -117,7 +117,7 @@ * * \param[in,out] AudioInterfaceInfo Pointer to a structure containing an Audio Class configuration and state. */ - void Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int Audio_Device_ProcessControlRequest(USB_ClassInfo_Audio_Device_t* const AudioInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** Audio class driver callback for the setting and retrieval of streaming endpoint properties. This callback must be implemented * in the user application to handle property manipulations on streaming audio endpoints. From 6f01c3169808402c3752bd220ebf25abf31304af Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:16:32 -0500 Subject: [PATCH 063/104] Adding return code to MIDI_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h b/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h index e4b90a747..985307b48 100644 --- a/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/MIDIClassDevice.h @@ -158,10 +158,11 @@ * * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state. */ - static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); - static inline void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) + static inline int MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + static inline int MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) { (void)MIDIInterfaceInfo; + return 0; } /* Disable C linkage for C++ Compilers: */ From 6e92c32f7bc1c92d98a4d8d2bfa5a7efc65abfa8 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:17:52 -0500 Subject: [PATCH 064/104] Adding return code to PRNT_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c b/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c index bd4f8e9ff..03da9239e 100644 --- a/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.c @@ -37,13 +37,13 @@ #define __INCLUDE_FROM_PRINTER_DEVICE_C #include "PrinterClassDevice.h" -void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) +int PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) { if (!(Endpoint_IsSETUPReceived())) - return; + return 0; if (USB_ControlRequest.wIndex != PRNTInterfaceInfo->Config.InterfaceNumber) - return; + return 0; switch (USB_ControlRequest.bRequest) { @@ -55,13 +55,14 @@ void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTIn while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } uint16_t IEEEStringLen = strlen(PRNTInterfaceInfo->Config.IEEE1284String); Endpoint_Write_16_BE(IEEEStringLen); Endpoint_Write_Control_Stream_LE(PRNTInterfaceInfo->Config.IEEE1284String, IEEEStringLen); Endpoint_ClearStatusStage(); + return 1; } break; @@ -73,11 +74,12 @@ void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTIn while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } Endpoint_Write_8(PRNTInterfaceInfo->State.PortStatus); Endpoint_ClearStatusStage(); + return 1; } break; @@ -90,10 +92,12 @@ void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTIn PRNTInterfaceInfo->State.IsPrinterReset = true; EVENT_PRNT_Device_SoftReset(PRNTInterfaceInfo); + return 1; } break; } + return 0; } bool PRNT_Device_ConfigureEndpoints(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) From 1f1292d10c84802dd34d143cf3333c6205f183f9 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:18:30 -0500 Subject: [PATCH 065/104] Adding return code to PRNT_Device_ProcessControlRequest() --- LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h b/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h index c86aec8e5..61c6883e2 100644 --- a/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h +++ b/LUFA/Drivers/USB/Class/Device/PrinterClassDevice.h @@ -122,7 +122,7 @@ * * \param[in,out] PRNTInterfaceInfo Pointer to a structure containing a Printer Class configuration and state. */ - void PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); + int PRNT_Device_ProcessControlRequest(USB_ClassInfo_PRNT_Device_t* const PRNTInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1); /** General management task for a given Printer class interface, required for the correct operation of the interface. This should * be called frequently in the main program loop, before the master USB management task \ref USB_USBTask(). From 3afc996d83d1103985b47871f89100f628910721 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:19:55 -0500 Subject: [PATCH 066/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/DualMIDI/DualMIDI.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/DualMIDI/DualMIDI.c b/Demos/Device/ClassDriver/DualMIDI/DualMIDI.c index 1f00ba0da..d3364bb8e 100644 --- a/Demos/Device/ClassDriver/DualMIDI/DualMIDI.c +++ b/Demos/Device/ClassDriver/DualMIDI/DualMIDI.c @@ -204,8 +204,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); + return MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); } From a12b700dd4983419faf0deb764f3a3d8b77dd762 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:20:12 -0500 Subject: [PATCH 067/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/DualMIDI/DualMIDI.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/DualMIDI/DualMIDI.h b/Demos/Device/ClassDriver/DualMIDI/DualMIDI.h index ca64e01b5..709c471ae 100644 --- a/Demos/Device/ClassDriver/DualMIDI/DualMIDI.h +++ b/Demos/Device/ClassDriver/DualMIDI/DualMIDI.h @@ -72,7 +72,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From fc62f795aed7cc011696508d7070d79af60fbd25 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 12:20:38 -0500 Subject: [PATCH 068/104] Adding return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/MIDI/MIDI.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/MIDI/MIDI.c b/Demos/Device/ClassDriver/MIDI/MIDI.c index e3a14c827..722c83b7d 100644 --- a/Demos/Device/ClassDriver/MIDI/MIDI.c +++ b/Demos/Device/ClassDriver/MIDI/MIDI.c @@ -204,8 +204,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); + return MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); } From b2c92e7ea6d5857c74841bccc56ab0513169c597 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 13:09:30 -0500 Subject: [PATCH 069/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/MIDIToneGenerator/MIDIToneGenerator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Projects/MIDIToneGenerator/MIDIToneGenerator.c b/Projects/MIDIToneGenerator/MIDIToneGenerator.c index 98cd596fc..244a1ec15 100644 --- a/Projects/MIDIToneGenerator/MIDIToneGenerator.c +++ b/Projects/MIDIToneGenerator/MIDIToneGenerator.c @@ -245,8 +245,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); + return MIDI_Device_ProcessControlRequest(&Keyboard_MIDI_Interface); } From 68d8439ae810f21412158a5de7c9991d060158b0 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 13:12:03 -0500 Subject: [PATCH 070/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/Printer/BootloaderPrinter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bootloaders/Printer/BootloaderPrinter.c b/Bootloaders/Printer/BootloaderPrinter.c index aaf3ef1cc..06fe8e564 100644 --- a/Bootloaders/Printer/BootloaderPrinter.c +++ b/Bootloaders/Printer/BootloaderPrinter.c @@ -481,7 +481,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - PRNT_Device_ProcessControlRequest(&TextOnly_Printer_Interface); + return PRNT_Device_ProcessControlRequest(&TextOnly_Printer_Interface); } From 87c9108b99b829b097b3689e5c41ab787d0f52a8 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 13:12:17 -0500 Subject: [PATCH 071/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/Printer/BootloaderPrinter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootloaders/Printer/BootloaderPrinter.h b/Bootloaders/Printer/BootloaderPrinter.h index b8d421e1e..959740291 100644 --- a/Bootloaders/Printer/BootloaderPrinter.h +++ b/Bootloaders/Printer/BootloaderPrinter.h @@ -102,7 +102,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 231648044f0d6ceeb1d99cb4866863a052f83727 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:17:56 -0500 Subject: [PATCH 072/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/CDC/BootloaderCDC.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index cb6a980cc..61a3b9411 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -219,13 +219,13 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Ignore any requests that aren't directed to the CDC interface */ if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != (REQTYPE_CLASS | REQREC_INTERFACE)) { - return; + return 0; } /* Activity - toggle indicator LEDs */ @@ -242,6 +242,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the line coding data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t)); Endpoint_ClearOUT(); + return 1; } break; @@ -253,6 +254,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Read the line coding data in from the host into the global struct */ Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t)); Endpoint_ClearIN(); + return 1; } break; @@ -261,10 +263,12 @@ void EVENT_USB_Device_ControlRequest(void) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } #if !defined(NO_BLOCK_SUPPORT) From 8890ffa20bee8698c713eb75342f7353ddcfe159 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:20:19 -0500 Subject: [PATCH 073/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/DFU/BootloaderDFU.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 4a0d73043..5cb13aa74 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@ -247,13 +247,13 @@ ISR(TIMER1_OVF_vect, ISR_BLOCK) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Ignore any requests that aren't directed to the DFU interface */ if ((USB_ControlRequest.bmRequestType & (CONTROL_REQTYPE_TYPE | CONTROL_REQTYPE_RECIPIENT)) != (REQTYPE_CLASS | REQREC_INTERFACE)) { - return; + return 0; } /* Activity - toggle indicator LEDs */ @@ -283,7 +283,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsOUTReceived())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } /* First byte of the data stage is the DNLOAD request's command */ @@ -415,6 +415,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearOUT(); Endpoint_ClearStatusStage(); + return 1; break; case DFU_REQ_UPLOAD: @@ -423,7 +424,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } if (DFU_State != dfuUPLOAD_IDLE) @@ -515,6 +516,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; break; case DFU_REQ_GETSTATUS: Endpoint_ClearSETUP(); @@ -522,7 +524,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } /* Write 8-bit status value */ @@ -541,6 +543,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; break; case DFU_REQ_CLRSTATUS: Endpoint_ClearSETUP(); @@ -549,6 +552,7 @@ void EVENT_USB_Device_ControlRequest(void) DFU_Status = OK; Endpoint_ClearStatusStage(); + return 1; break; case DFU_REQ_GETSTATE: Endpoint_ClearSETUP(); @@ -556,7 +560,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsINReady())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } /* Write the current device state to the endpoint */ @@ -565,6 +569,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; break; case DFU_REQ_ABORT: Endpoint_ClearSETUP(); @@ -573,8 +578,10 @@ void EVENT_USB_Device_ControlRequest(void) DFU_State = dfuIDLE; Endpoint_ClearStatusStage(); + return 1; break; } + return 0; } /** Routine to discard the specified number of bytes from the control endpoint stream. This is used to From ebc1344325cad6344697ec8e7515494196ceb4c6 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:20:47 -0500 Subject: [PATCH 074/104] Added return code to EVENT_USB_Device_ControlRequest() --- Bootloaders/DFU/BootloaderDFU.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bootloaders/DFU/BootloaderDFU.h b/Bootloaders/DFU/BootloaderDFU.h index 73c4b4004..58230f608 100644 --- a/Bootloaders/DFU/BootloaderDFU.h +++ b/Bootloaders/DFU/BootloaderDFU.h @@ -198,7 +198,7 @@ static void SetupHardware(void); static void ResetHardware(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #if defined(INCLUDE_FROM_BOOTLOADER_C) static void DiscardFillerBytes(uint8_t NumberOfBytes); From 99bee51db1e025cc226b48fe4990ba35a1b93213 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:21:32 -0500 Subject: [PATCH 075/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/MassStorage/MassStorage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.c b/Demos/Device/ClassDriver/MassStorage/MassStorage.c index 48a2f96fd..fc7f20f6a 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.c +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.c @@ -140,9 +140,9 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - MS_Device_ProcessControlRequest(&Disk_MS_Interface); + return MS_Device_ProcessControlRequest(&Disk_MS_Interface); } /** Mass Storage class driver callback function the reception of SCSI commands from the host, which must be processed. From aa6f8ec6edcc57b1cd721e04f31528f83304bb6a Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:21:49 -0500 Subject: [PATCH 076/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/ClassDriver/MassStorage/MassStorage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/ClassDriver/MassStorage/MassStorage.h b/Demos/Device/ClassDriver/MassStorage/MassStorage.h index 203df52e0..029d5ac65 100644 --- a/Demos/Device/ClassDriver/MassStorage/MassStorage.h +++ b/Demos/Device/ClassDriver/MassStorage/MassStorage.h @@ -75,7 +75,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo); From b82789afe57bb80c659d082be32b97ae716d1a71 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:23:14 -0500 Subject: [PATCH 077/104] Added return code to EVENT_USB_Device_ControlRequest() --- .../Incomplete/TestAndMeasurement/TestAndMeasurement.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c index b8bdf0f25..9811bd8c0 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c +++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.c @@ -153,7 +153,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { uint8_t TMCRequestStatus = TMC_STATUS_SUCCESS; @@ -188,6 +188,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -211,6 +212,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -243,6 +245,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -266,6 +269,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -294,6 +298,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -316,6 +321,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -327,10 +333,12 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the device capabilities to the control endpoint */ Endpoint_Write_Control_Stream_LE(&Capabilities, sizeof(TMC_Capabilities_t)); Endpoint_ClearOUT(); + return 1; } break; } + return 0; } void ProcessSentMessage(uint8_t* const Data, const uint8_t Length) From d0ab06b1b2db5963c7f58703a3fa87ec0498f91a Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:23:29 -0500 Subject: [PATCH 078/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h index 95ea13bb7..e2a01ff22 100644 --- a/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h +++ b/Demos/Device/Incomplete/TestAndMeasurement/TestAndMeasurement.h @@ -144,7 +144,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From b142ebbb4bbd22eb35a5ddffb5f6d033fabee092 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:24:43 -0500 Subject: [PATCH 079/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/AudioInput/AudioInput.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.c b/Demos/Device/LowLevel/AudioInput/AudioInput.c index 5ae7c6fd9..833f7e4bd 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.c +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.c @@ -130,7 +130,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Process General and Audio specific control requests */ switch (USB_ControlRequest.bRequest) @@ -144,6 +144,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */ StreamingAudioInterfaceSelected = ((USB_ControlRequest.wValue) != 0); + return 1; } break; @@ -155,6 +156,7 @@ void EVENT_USB_Device_ControlRequest(void) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -179,6 +181,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Adjust sample reload timer to the new frequency */ OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); + return 1; } } @@ -203,11 +206,13 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); Endpoint_ClearOUT(); + return 1; } } break; } + return 0; } /** ISR to handle the reloading of the data endpoint with the next sample. */ From 0dbca1c37ae4f431ba888791f1982cedf4ce5814 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:24:57 -0500 Subject: [PATCH 080/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/AudioInput/AudioInput.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/AudioInput/AudioInput.h b/Demos/Device/LowLevel/AudioInput/AudioInput.h index ce0716312..51623345a 100644 --- a/Demos/Device/LowLevel/AudioInput/AudioInput.h +++ b/Demos/Device/LowLevel/AudioInput/AudioInput.h @@ -76,7 +76,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From b234071c222e3a8035b594c992b4a9d553eb0a7f Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:25:57 -0500 Subject: [PATCH 081/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/AudioOutput/AudioOutput.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c index 89fef035a..b817aff9a 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.c +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.c @@ -156,7 +156,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Process General and Audio specific control requests */ switch (USB_ControlRequest.bRequest) @@ -170,6 +170,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Check if the host is enabling the audio interface (setting AlternateSetting to 1) */ StreamingAudioInterfaceSelected = ((USB_ControlRequest.wValue) != 0); + return 1; } break; @@ -181,6 +182,7 @@ void EVENT_USB_Device_ControlRequest(void) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -205,6 +207,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Adjust sample reload timer to the new frequency */ OCR0A = ((F_CPU / 8 / CurrentAudioSampleFrequency) - 1); + return 1; } } @@ -229,11 +232,13 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearSETUP(); Endpoint_Write_Control_Stream_LE(SampleRate, sizeof(SampleRate)); Endpoint_ClearOUT(); + return 1; } } break; } + return 0; } /** ISR to handle the reloading of the PWM timer with the next sample. */ From b97753f99b0488380fa79eb85db317c1ddac1d5b Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:26:13 -0500 Subject: [PATCH 082/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/AudioOutput/AudioOutput.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h index 188a36acb..0149c6bb7 100644 --- a/Demos/Device/LowLevel/AudioOutput/AudioOutput.h +++ b/Demos/Device/LowLevel/AudioOutput/AudioOutput.h @@ -68,7 +68,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 314b72bb7ffb00484ddb8a424a361628b08420d3 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:26:42 -0500 Subject: [PATCH 083/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/BulkVendor/BulkVendor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/BulkVendor/BulkVendor.c b/Demos/Device/LowLevel/BulkVendor/BulkVendor.c index 865572187..59008eb14 100644 --- a/Demos/Device/LowLevel/BulkVendor/BulkVendor.c +++ b/Demos/Device/LowLevel/BulkVendor/BulkVendor.c @@ -130,7 +130,8 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { // Process vendor specific control requests here + return 0; } From 394a78c5ded87d500f0607e82088ed112a69b935 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:27:04 -0500 Subject: [PATCH 084/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/BulkVendor/BulkVendor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/BulkVendor/BulkVendor.h b/Demos/Device/LowLevel/BulkVendor/BulkVendor.h index be1c2e331..8895407a6 100644 --- a/Demos/Device/LowLevel/BulkVendor/BulkVendor.h +++ b/Demos/Device/LowLevel/BulkVendor/BulkVendor.h @@ -70,7 +70,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 7bbf94c24ea1bbbec417587915a7a7b60e5a3d19 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:27:41 -0500 Subject: [PATCH 085/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c index dd470779a..3f343babc 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c +++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.c @@ -156,7 +156,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Determine which interface's Line Coding data is being set from the wIndex parameter */ void* LineEncodingData = (USB_ControlRequest.wIndex == 0) ? &LineEncoding1 : &LineEncoding2; @@ -172,6 +172,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the line coding data to the control endpoint */ Endpoint_Write_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t)); Endpoint_ClearOUT(); + return 1; } break; @@ -183,6 +184,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Read the line coding data in from the host into the global struct */ Endpoint_Read_Control_Stream_LE(LineEncodingData, sizeof(CDC_LineEncoding_t)); Endpoint_ClearIN(); + return 1; } break; @@ -191,10 +193,12 @@ void EVENT_USB_Device_ControlRequest(void) { Endpoint_ClearSETUP(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } /** Function to manage CDC data transmission and reception to and from the host for the first CDC interface, which sends joystick From 746c03ee357263890598444a9b26363eba520557 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:27:59 -0500 Subject: [PATCH 086/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h index 89259d9b8..c48237349 100644 --- a/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h +++ b/Demos/Device/LowLevel/DualVirtualSerial/DualVirtualSerial.h @@ -71,7 +71,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 1a4027bbae4a4e02dd88634bbc962a052d1bbbf4 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:28:34 -0500 Subject: [PATCH 087/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Joystick/Joystick.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/Joystick/Joystick.c b/Demos/Device/LowLevel/Joystick/Joystick.c index 4a57f07d9..606bd3349 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.c +++ b/Demos/Device/LowLevel/Joystick/Joystick.c @@ -118,7 +118,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -136,10 +136,12 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the report data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&JoystickReportData, sizeof(JoystickReportData)); Endpoint_ClearOUT(); + return 1; } break; } + return 0; } /** Fills the given HID report data structure with the next HID report to send to the host. From be0724c8d873b526696e720628b9e439e8ca851f Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:28:52 -0500 Subject: [PATCH 088/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Joystick/Joystick.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/Joystick/Joystick.h b/Demos/Device/LowLevel/Joystick/Joystick.h index af319bffb..2ff91bda8 100644 --- a/Demos/Device/LowLevel/Joystick/Joystick.h +++ b/Demos/Device/LowLevel/Joystick/Joystick.h @@ -83,7 +83,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); bool GetNextReport(USB_JoystickReport_Data_t* const ReportData); From 2ac84fb41785a1d900d039170e72d7bd55f8af1d Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:29:48 -0500 Subject: [PATCH 089/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Keyboard/Keyboard.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.c b/Demos/Device/LowLevel/Keyboard/Keyboard.c index 9342db359..35bdc8580 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.c +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.c @@ -143,7 +143,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -161,6 +161,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the report data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData)); Endpoint_ClearOUT(); + return 1; } break; @@ -173,7 +174,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsOUTReceived())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } /* Read in the LED report from the host */ @@ -184,6 +185,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Process the incoming LED report */ ProcessLEDReport(LEDStatus); + return 1; } break; @@ -197,6 +199,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -208,6 +211,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Set or clear the flag depending on what the host indicates that the current Protocol should be */ UsingReportProtocol = (USB_ControlRequest.wValue != 0); + return 1; } break; @@ -219,6 +223,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Get idle period in MSB, IdleCount must be multiplied by 4 to get number of milliseconds */ IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6); + return 1; } break; @@ -232,10 +237,12 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } /** Event handler for the USB device Start Of Frame event. */ From e570bc07a64cae94fd2f89a271ce42431d9e8865 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:30:05 -0500 Subject: [PATCH 090/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Keyboard/Keyboard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/Keyboard/Keyboard.h b/Demos/Device/LowLevel/Keyboard/Keyboard.h index 676eca536..252b9466d 100644 --- a/Demos/Device/LowLevel/Keyboard/Keyboard.h +++ b/Demos/Device/LowLevel/Keyboard/Keyboard.h @@ -73,7 +73,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); void CreateKeyboardReport(USB_KeyboardReport_Data_t* const ReportData); From 82af387de2660b551726ad19dae677f3205143ea Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:30:53 -0500 Subject: [PATCH 091/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c index ebb28d230..3d6f0106a 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.c @@ -130,7 +130,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { uint8_t* ReportData; uint8_t ReportSize; @@ -161,6 +161,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Clear the report data afterwards */ memset(ReportData, 0, ReportSize); + return 1; } break; @@ -173,7 +174,7 @@ void EVENT_USB_Device_ControlRequest(void) while (!(Endpoint_IsOUTReceived())) { if (USB_DeviceState == DEVICE_STATE_Unattached) - return; + return 0; } /* Read in the LED report from the host */ @@ -184,10 +185,12 @@ void EVENT_USB_Device_ControlRequest(void) /* Process the incoming LED report */ Keyboard_ProcessLEDReport(LEDStatus); + return 1; } break; } + return 0; } /** Processes a given Keyboard LED report from the host, and sets the board LEDs to match. Since the Keyboard From 2fa0fc0e3108931b39448d28576fe1c8b91c924b Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:31:09 -0500 Subject: [PATCH 092/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h index ce68529c2..37661ff78 100644 --- a/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h +++ b/Demos/Device/LowLevel/KeyboardMouse/KeyboardMouse.h @@ -70,7 +70,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); #endif From 3920be9c4082fe5be40082a25a4393129a0241cf Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:31:47 -0500 Subject: [PATCH 093/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/MassStorage/MassStorage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.c b/Demos/Device/LowLevel/MassStorage/MassStorage.c index 46762d45d..2f4f3224a 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.c +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.c @@ -140,7 +140,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Process UFI specific control requests */ switch (USB_ControlRequest.bRequest) @@ -153,6 +153,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Indicate that the current transfer should be aborted */ IsMassStoreReset = true; + return 1; } break; @@ -166,10 +167,12 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } /** Task to manage the Mass Storage interface, reading in Command Block Wrappers from the host, processing the SCSI commands they From e9fcdb074bf7e6789a235edd6dcf0bc979e62ba4 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:32:06 -0500 Subject: [PATCH 094/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/MassStorage/MassStorage.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/MassStorage/MassStorage.h b/Demos/Device/LowLevel/MassStorage/MassStorage.h index 62db99612..727f50e9c 100644 --- a/Demos/Device/LowLevel/MassStorage/MassStorage.h +++ b/Demos/Device/LowLevel/MassStorage/MassStorage.h @@ -81,7 +81,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #if defined(INCLUDE_FROM_MASSSTORAGE_C) static bool ReadInCommandBlock(void); From d1deb70bd12dbb606f6a2106ffc962a49fd5cbef Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:32:56 -0500 Subject: [PATCH 095/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Mouse/Mouse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/Mouse/Mouse.c b/Demos/Device/LowLevel/Mouse/Mouse.c index b3662cfd0..a6cdab7cc 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.c +++ b/Demos/Device/LowLevel/Mouse/Mouse.c @@ -141,7 +141,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Handle HID Class specific requests */ switch (USB_ControlRequest.bRequest) @@ -162,6 +162,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Clear the report data afterwards */ memset(&MouseReportData, 0, sizeof(MouseReportData)); + return 1; } break; @@ -175,6 +176,7 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; @@ -186,6 +188,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Set or clear the flag depending on what the host indicates that the current Protocol should be */ UsingReportProtocol = (USB_ControlRequest.wValue != 0); + return 1; } break; @@ -197,6 +200,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Get idle period in MSB, must multiply by 4 to get the duration in milliseconds */ IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6); + return 1; } break; @@ -210,10 +214,12 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_ClearIN(); Endpoint_ClearStatusStage(); + return 1; } break; } + return 0; } /** Event handler for the USB device Start Of Frame event. */ From b336e7d059f7d7f5411ed044bdb10ca67d7b2675 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:33:13 -0500 Subject: [PATCH 096/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/Mouse/Mouse.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/Mouse/Mouse.h b/Demos/Device/LowLevel/Mouse/Mouse.h index d39762cb9..48347e51c 100644 --- a/Demos/Device/LowLevel/Mouse/Mouse.h +++ b/Demos/Device/LowLevel/Mouse/Mouse.h @@ -72,7 +72,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); void EVENT_USB_Device_StartOfFrame(void); void CreateMouseReport(USB_MouseReport_Data_t* const ReportData); From 23fc8070179e39add4d7684df523e6c6394c57fa Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:33:54 -0500 Subject: [PATCH 097/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c index 324c55093..2884e3b06 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.c @@ -128,7 +128,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Process RNDIS class commands */ switch (USB_ControlRequest.bRequest) @@ -144,6 +144,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Process the RNDIS message */ ProcessRNDISControlMessage(); + return 1; } break; @@ -166,10 +167,12 @@ void EVENT_USB_Device_ControlRequest(void) /* Reset the message header once again after transmission */ MessageHeader->MessageLength = 0; + return 1; } break; } + return 0; } /** Task to manage the sending and receiving of encapsulated RNDIS data and notifications. This removes the RNDIS From aba5eac055d59d5dce23ff57e1466f80b0d4eb69 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:34:09 -0500 Subject: [PATCH 098/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h index 440b709cb..cd4725b51 100644 --- a/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h +++ b/Demos/Device/LowLevel/RNDISEthernet/RNDISEthernet.h @@ -81,7 +81,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 7aa7ea6c893d41707fc3153d36e69b3192c1c591 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:34:57 -0500 Subject: [PATCH 099/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c index 4d7937797..1ce82dcd8 100644 --- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c +++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.c @@ -136,7 +136,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) * the device from the USB host before passing along unhandled control requests to the library for processing * internally. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { /* Process CDC specific control requests */ switch (USB_ControlRequest.bRequest) @@ -149,6 +149,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Write the line coding data to the control endpoint */ Endpoint_Write_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t)); Endpoint_ClearOUT(); + return 1; } break; @@ -160,6 +161,7 @@ void EVENT_USB_Device_ControlRequest(void) /* Read the line coding data in from the host into the global struct */ Endpoint_Read_Control_Stream_LE(&LineEncoding, sizeof(CDC_LineEncoding_t)); Endpoint_ClearIN(); + return 1; } break; @@ -173,10 +175,12 @@ void EVENT_USB_Device_ControlRequest(void) lines. The mask is read in from the wValue parameter in USB_ControlRequest, and can be masked against the CONTROL_LINE_OUT_* masks to determine the RTS and DTR line states using the following code: */ + return 1; } break; } + return 0; } /** Function to manage CDC data transmission and reception to and from the host. */ From db82f9e348e0a14e4724db2dcafc87c5c5a82ecd Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:35:18 -0500 Subject: [PATCH 100/104] Added return code to EVENT_USB_Device_ControlRequest() --- Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h index 29f34e99f..ce27d5dd4 100644 --- a/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h +++ b/Demos/Device/LowLevel/VirtualSerial/VirtualSerial.h @@ -70,7 +70,7 @@ void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 6e60882e9092eb5d8fd4440a619b8e4ac5e95ad7 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:36:36 -0500 Subject: [PATCH 101/104] Added return code to EVENT_USB_Device_ControlRequest() --- LUFA/CodeTemplates/DeviceTemplate/DeviceApplication.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LUFA/CodeTemplates/DeviceTemplate/DeviceApplication.c b/LUFA/CodeTemplates/DeviceTemplate/DeviceApplication.c index ff36c18de..a8eaeee9d 100644 --- a/LUFA/CodeTemplates/DeviceTemplate/DeviceApplication.c +++ b/LUFA/CodeTemplates/DeviceTemplate/DeviceApplication.c @@ -100,7 +100,7 @@ void EVENT_USB_Device_ConfigurationChanged(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { - + return 0; /* If event is handled here, return 1 */ } From cde305c45eb2dcb237924a5a3cb8070a47204103 Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:37:42 -0500 Subject: [PATCH 102/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/RelayBoard/RelayBoard.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Projects/RelayBoard/RelayBoard.c b/Projects/RelayBoard/RelayBoard.c index 12732c664..27862c3b1 100644 --- a/Projects/RelayBoard/RelayBoard.c +++ b/Projects/RelayBoard/RelayBoard.c @@ -72,7 +72,7 @@ void SetupHardware(void) } /** Event handler for the library USB Control Request reception event. */ -void EVENT_USB_Device_ControlRequest(void) +int EVENT_USB_Device_ControlRequest(void) { const uint8_t SerialNumber[5] = { 0, 0, 0, 0, 1 }; uint8_t ControlData[2] = { 0, 0 }; @@ -104,6 +104,7 @@ void EVENT_USB_Device_ControlRequest(void) if (ControlData[1]) PORTC &= ~RELAY4; else PORTC |= RELAY4; break; } + return 1; } break; @@ -137,9 +138,11 @@ void EVENT_USB_Device_ControlRequest(void) Endpoint_Write_Control_Stream_LE(ControlData, sizeof(ControlData)); Endpoint_ClearOUT(); + return 1; } break; } + return 0; } From 9f34f880aad886315d019fcf357458c9cd4818ea Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:38:04 -0500 Subject: [PATCH 103/104] Added return code to EVENT_USB_Device_ControlRequest() --- Projects/RelayBoard/RelayBoard.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Projects/RelayBoard/RelayBoard.h b/Projects/RelayBoard/RelayBoard.h index d317410df..0c5113aa3 100644 --- a/Projects/RelayBoard/RelayBoard.h +++ b/Projects/RelayBoard/RelayBoard.h @@ -59,7 +59,7 @@ /* Function Prototypes: */ void SetupHardware(void); - void EVENT_USB_Device_ControlRequest(void); + int EVENT_USB_Device_ControlRequest(void); #endif From 8dfa920bb5ea0be5b04032b63e0aec126d23999c Mon Sep 17 00:00:00 2001 From: Ag Primatic Date: Mon, 16 Nov 2015 16:44:17 -0500 Subject: [PATCH 104/104] Fixed race condition when multiple SETUP messages queued (2nd try). --- LUFA/Drivers/USB/Core/DeviceStandardReq.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/LUFA/Drivers/USB/Core/DeviceStandardReq.c b/LUFA/Drivers/USB/Core/DeviceStandardReq.c index b490c4145..426d74055 100644 --- a/LUFA/Drivers/USB/Core/DeviceStandardReq.c +++ b/LUFA/Drivers/USB/Core/DeviceStandardReq.c @@ -63,8 +63,6 @@ void USB_Device_ProcessControlRequest(void) *(RequestHeader++) = Endpoint_Read_8(); #endif - EVENT_USB_Device_ControlRequest(); - if (!Endpoint_IsSETUPReceived()) { return;