aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-09-10 06:41:57 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-09-10 06:41:57 +0000
commite918d977b1d4465d525ee0f742dbdeec20f7885c (patch)
tree4da2b0cb02f251dcb1527cb2b205a5dc0123e3cd /LUFA
parentb221e7d175e4b5ca463fdd6d05b8c3fc71bd7c40 (diff)
downloadlufa-e918d977b1d4465d525ee0f742dbdeec20f7885c.tar.gz
lufa-e918d977b1d4465d525ee0f742dbdeec20f7885c.tar.bz2
lufa-e918d977b1d4465d525ee0f742dbdeec20f7885c.zip
Prevent the CDC Device Class driver from sending empty IN packets on every service task call - only send termination packets when data is in the endpoint.
Diffstat (limited to 'LUFA')
-rw-r--r--LUFA/Doxygen.conf2
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.c26
-rw-r--r--LUFA/Drivers/USB/Class/Device/CDC.h4
-rw-r--r--LUFA/Drivers/USB/Class/Host/StillImage.h2
4 files changed, 19 insertions, 15 deletions
diff --git a/LUFA/Doxygen.conf b/LUFA/Doxygen.conf
index 260340c05..9ea64ba73 100644
--- a/LUFA/Doxygen.conf
+++ b/LUFA/Doxygen.conf
@@ -1481,4 +1481,4 @@ DOT_CLEANUP = YES
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
-SEARCHENGINE = NO
+SEARCHENGINE = YES
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.c b/LUFA/Drivers/USB/Class/Device/CDC.c
index 816a5f13d..aaa821e10 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.c
+++ b/LUFA/Drivers/USB/Class/Device/CDC.c
@@ -143,11 +143,11 @@ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
if (!(Endpoint_IsReadWriteAllowed()))
- {
- uint8_t ErrorCode;
-
+ {
Endpoint_ClearIN();
+ uint8_t ErrorCode;
+
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
return ErrorCode;
}
@@ -161,20 +161,26 @@ uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
if ((USB_DeviceState != DEVICE_STATE_Configured) || !(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS))
return ENDPOINT_READYWAIT_NoError;
+ uint8_t ErrorCode;
+
Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);
+
+ if (!(Endpoint_BytesInEndpoint()))
+ return ENDPOINT_READYWAIT_NoError;
+
+ bool BankFull = !(Endpoint_IsReadWriteAllowed());
- if (Endpoint_BytesInEndpoint())
+ Endpoint_ClearIN();
+
+ if (BankFull)
{
- uint8_t ErrorCode;
-
- Endpoint_ClearIN();
-
if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)
return ErrorCode;
+
+ Endpoint_ClearIN();
}
- Endpoint_ClearIN();
- return Endpoint_WaitUntilReady();
+ return ENDPOINT_READYWAIT_NoError;
}
uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
diff --git a/LUFA/Drivers/USB/Class/Device/CDC.h b/LUFA/Drivers/USB/Class/Device/CDC.h
index 5905474ce..605c3b7e9 100644
--- a/LUFA/Drivers/USB/Class/Device/CDC.h
+++ b/LUFA/Drivers/USB/Class/Device/CDC.h
@@ -192,10 +192,8 @@
/** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.
*
* \param[in,out] CDCInterfaceInfo Pointer to a structure containing a CDC Class configuration and state.
- *
- * \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum
*/
- uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
+ void CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);
/** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial
* control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist
diff --git a/LUFA/Drivers/USB/Class/Host/StillImage.h b/LUFA/Drivers/USB/Class/Host/StillImage.h
index 66dc3925c..fd67134c1 100644
--- a/LUFA/Drivers/USB/Class/Host/StillImage.h
+++ b/LUFA/Drivers/USB/Class/Host/StillImage.h
@@ -181,7 +181,7 @@
/** Receives an asynchronous event block from the device via the asynchronous events pipe.
*
* \param[in,out] SIInterfaceInfo Pointer to a structure containing a Still Image Class host configuration and state
- * \param[out] SI_PIMA_Container_t Pointer to a PIMA container structure where the event should be stored
+ * \param[out] PIMAHeader Pointer to a PIMA container structure where the event should be stored
*
* \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device
* returned a logical command failure