aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Class/Device/CDC.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-08-22 02:45:20 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-08-22 02:45:20 +0000
commit1be3436e895c9937dcd4ebbec33ea199f3e26db2 (patch)
tree79dea3910fc817fa020c4f13f9f981d137005ee9 /LUFA/Drivers/USB/Class/Device/CDC.c
parent81998ce297fd9959f505e96a69337f3548db0d71 (diff)
downloadlufa-1be3436e895c9937dcd4ebbec33ea199f3e26db2.tar.gz
lufa-1be3436e895c9937dcd4ebbec33ea199f3e26db2.tar.bz2
lufa-1be3436e895c9937dcd4ebbec33ea199f3e26db2.zip
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.
Diffstat (limited to 'LUFA/Drivers/USB/Class/Device/CDC.c')
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index 39154608e..bf852c775 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;