From 1be3436e895c9937dcd4ebbec33ea199f3e26db2 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sun, 22 Aug 2010 02:45:20 +0000 Subject: Moved calls to Device mode Class Driver events to after the request has been acknowledged, so that long event handlers do do skew the timing of the control requests. Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control request handler. --- LUFA/Drivers/USB/Class/Device/CDC.c | 16 +++++++++------- LUFA/Drivers/USB/Class/Device/RNDIS.c | 3 ++- LUFA/ManPages/ChangeLog.txt | 4 ++++ 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'LUFA') diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c index 39154608e4..bf852c7755 100644 --- a/LUFA/Drivers/USB/Class/Device/CDC.c +++ b/LUFA/Drivers/USB/Class/Device/CDC.c @@ -64,21 +64,24 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); + Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding)); - EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); Endpoint_ClearIN(); + + EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo); } break; case REQ_SetControlLineState: if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearSETUP(); - + Endpoint_ClearSETUP(); + CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue; - EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); Endpoint_ClearStatusStage(); + + EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo); } break; @@ -86,10 +89,9 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* const CDCInter if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { Endpoint_ClearSETUP(); - - EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); - Endpoint_ClearStatusStage(); + + EVENT_CDC_Device_BreakSent(CDCInterfaceInfo, (uint8_t)USB_ControlRequest.wValue); } break; diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c index ff790b771f..da1e4507c2 100644 --- a/LUFA/Drivers/USB/Class/Device/RNDIS.c +++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c @@ -83,8 +83,9 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI Endpoint_ClearSETUP(); Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength); - RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo); Endpoint_ClearIN(); + + RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo); } break; diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index f37117a98b..8fc07116a9 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -20,6 +20,8 @@ * SCSI_Codes.h file as these values are part of the MassStorage Class Driver * - Added compile time error to the AVRISP-MKII project when built for the U4 chips, as the default VTARGET detection ADC channel * does not exist on these chips (thanks to Marco) + * - Moved calls to Device mode Class Driver events to after the request has been acknowledged, so that long event handlers do + * do skew the timing of the control requests * * Fixed: * - Fixed USB_GetHIDReportItemInfo() function modifying the given report item's data when the report item does not exist @@ -28,6 +30,8 @@ * missed SCSI sense values when the host retrieves the sense key (thanks to Martin Degelsegger) * - Fixed critical pipe/endpoint memory allocation issue where the bank memory address space could be silently overlapped * in the USB controller if the endpoints or pipes were allocated in anything other than ascending order (thanks to Martin Degelsegger) + * - Fixed USBtoSerial and Benito project SetLineEncoding calls failing if the USART is busy, due to the RX ISR delaying the control + * request handler * * \section Sec_ChangeLog100807 Version 100807 * New: -- cgit v1.2.3