aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-05-07 06:54:08 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-05-07 06:54:08 +0000
commita9e0935a90346beb0c981924becc1f55d969a08b (patch)
tree626edea1cd4136a3ade4ec015f93aac2d5d5b7f6
parent57fe6b4fb97668eb15c4fa56095c0abd746d6c99 (diff)
downloadlufa-a9e0935a90346beb0c981924becc1f55d969a08b.tar.gz
lufa-a9e0935a90346beb0c981924becc1f55d969a08b.tar.bz2
lufa-a9e0935a90346beb0c981924becc1f55d969a08b.zip
Device mode class driver callbacks are now fired before the control request status stage is sent to prevent the host from timing out if another request is immediately fired and the device has a lengthy callback routine.
Inlined currently unused MIDI ProcessControlRequest routine.
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c4
-rw-r--r--LUFA/Drivers/USB/Class/Device/HID.c3
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.c5
-rw-r--r--LUFA/Drivers/USB/Class/Device/MIDI.h20
-rw-r--r--LUFA/Drivers/USB/Class/Device/RNDIS.c3
-rw-r--r--LUFA/ManPages/ChangeLog.txt2
6 files changed, 17 insertions, 20 deletions
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index e1cb554f9..f0c6edb12 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/LUFA/Drivers/USB/Class/Device/CDC.c
@@ -65,9 +65,8 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceIn
{
Endpoint_ClearSETUP();
Endpoint_Read_Control_Stream_LE(&CDCInterfaceInfo->State.LineEncoding, sizeof(CDCInterfaceInfo->State.LineEncoding));
- Endpoint_ClearIN();
-
EVENT_CDC_Device_LineEncodingChanged(CDCInterfaceInfo);
+ Endpoint_ClearIN();
}
break;
@@ -77,7 +76,6 @@ void CDC_Device_ProcessControlRequest(USB_ClassInfo_CDC_Device_t* CDCInterfaceIn
Endpoint_ClearSETUP();
CDCInterfaceInfo->State.ControlLineStates.HostToDevice = USB_ControlRequest.wValue;
-
EVENT_CDC_Device_ControLineStateChanged(CDCInterfaceInfo);
Endpoint_ClearStatusStage();
diff --git a/LUFA/Drivers/USB/Class/Device/HID.c b/LUFA/Drivers/USB/Class/Device/HID.c
index 7ff32498b..676650976 100644
--- a/LUFA/Drivers/USB/Class/Device/HID.c
+++ b/LUFA/Drivers/USB/Class/Device/HID.c
@@ -79,9 +79,8 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF);
Endpoint_Read_Control_Stream_LE(ReportOUTData, ReportOUTSize);
- Endpoint_ClearIN();
-
CALLBACK_HID_Device_ProcessHIDReport(HIDInterfaceInfo, ReportID, ReportOUTData, ReportOUTSize);
+ Endpoint_ClearIN();
}
break;
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.c b/LUFA/Drivers/USB/Class/Device/MIDI.c
index d3f8f55b6..1a66dc867 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.c
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.c
@@ -35,11 +35,6 @@
#define __INCLUDE_FROM_MIDI_DRIVER
#include "MIDI.h"
-void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
-{
-
-}
-
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{
memset(&MIDIInterfaceInfo->State, 0x00, sizeof(MIDIInterfaceInfo->State));
diff --git a/LUFA/Drivers/USB/Class/Device/MIDI.h b/LUFA/Drivers/USB/Class/Device/MIDI.h
index 11a05bfbb..00d34e000 100644
--- a/LUFA/Drivers/USB/Class/Device/MIDI.h
+++ b/LUFA/Drivers/USB/Class/Device/MIDI.h
@@ -112,13 +112,6 @@
*/
bool MIDI_Device_ConfigureEndpoints(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
- /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be
- * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
- *
- * \param[in,out] MIDIInterfaceInfo Pointer to a structure containing a MIDI Class configuration and state
- */
- void MIDI_Device_ProcessControlRequest(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
-
/** Sends a MIDI event packet to the host. If no host is connected, the event packet is discarded. Events are queued into the
* endpoint bank until either the endpoint bank is full, or \ref MIDI_Device_Flush() is called. This allows for multiple
* MIDI events to be packed into a single endpoint packet, increasing data throughput.
@@ -168,7 +161,18 @@
static inline void MIDI_Device_USBTask(USB_ClassInfo_MIDI_Device_t* const MIDIInterfaceInfo)
{
(void)MIDIInterfaceInfo;
- }
+ }
+
+ /** Processes incoming control requests from the host, that are directed to the given MIDI class interface. This should be
+ * linked to the library \ref EVENT_USB_Device_UnhandledControlRequest() event.
+ *
+ * \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)
+ {
+ (void)MIDIInterfaceInfo;
+ }
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
diff --git a/LUFA/Drivers/USB/Class/Device/RNDIS.c b/LUFA/Drivers/USB/Class/Device/RNDIS.c
index 1961e7e84..69e8e677d 100644
--- a/LUFA/Drivers/USB/Class/Device/RNDIS.c
+++ b/LUFA/Drivers/USB/Class/Device/RNDIS.c
@@ -83,9 +83,8 @@ void RNDIS_Device_ProcessControlRequest(USB_ClassInfo_RNDIS_Device_t* const RNDI
Endpoint_ClearSETUP();
Endpoint_Read_Control_Stream_LE(RNDISInterfaceInfo->State.RNDISMessageBuffer, USB_ControlRequest.wLength);
- Endpoint_ClearIN();
-
RNDIS_Device_ProcessRNDISControlMessage(RNDISInterfaceInfo);
+ Endpoint_ClearIN();
}
break;
diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index 8e6818304..4de0473a2 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -39,6 +39,8 @@
* now be implemented via seperate programming headers
* - The CDC class bootloader now uses a watchdog reset rather than a soft-reset when exited to ensure that all hardware is
* properly reset to their defaults
+ * - Device mode class driver callbacks are now fired before the control request status stage is sent to prevent the host from
+ * timing out if another request is immediately fired and the device has a lengthy callback routine
*
* <b>Fixed:</b>
* - Fixed software PDI/TPI programming mode in the AVRISP project not correctly toggling just the clock pin