Prevent the CDC Device Class driver from sending empty IN packets on every service...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 10 Sep 2009 06:41:57 +0000 (06:41 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 10 Sep 2009 06:41:57 +0000 (06:41 +0000)
LUFA/Doxygen.conf
LUFA/Drivers/USB/Class/Device/CDC.c
LUFA/Drivers/USB/Class/Device/CDC.h
LUFA/Drivers/USB/Class/Host/StillImage.h

index 260340c..9ea64ba 100644 (file)
@@ -1481,4 +1481,4 @@ DOT_CLEANUP            = YES
 # The SEARCHENGINE tag specifies whether or not a search engine should be \r
 # used. If set to NO the values of all tags below this one will be ignored.\r
 \r
-SEARCHENGINE           = NO\r
+SEARCHENGINE           = YES\r
index 816a5f1..aaa821e 100644 (file)
@@ -143,11 +143,11 @@ uint8_t CDC_Device_SendByte(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo,
        Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);\r
 \r
        if (!(Endpoint_IsReadWriteAllowed()))\r
-       {\r
-               uint8_t ErrorCode;\r
-       \r
+       {       \r
                Endpoint_ClearIN();\r
 \r
+               uint8_t ErrorCode;\r
+\r
                if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)\r
                  return ErrorCode;\r
        }\r
@@ -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))\r
          return ENDPOINT_READYWAIT_NoError;\r
 \r
+       uint8_t ErrorCode;\r
+\r
        Endpoint_SelectEndpoint(CDCInterfaceInfo->Config.DataINEndpointNumber);\r
+\r
+       if (!(Endpoint_BytesInEndpoint()))\r
+         return ENDPOINT_READYWAIT_NoError;\r
+       \r
+       bool BankFull = !(Endpoint_IsReadWriteAllowed());\r
        \r
-       if (Endpoint_BytesInEndpoint())\r
+       Endpoint_ClearIN();\r
+       \r
+       if (BankFull)\r
        {\r
-               uint8_t ErrorCode;\r
-\r
-               Endpoint_ClearIN();\r
-               \r
                if ((ErrorCode = Endpoint_WaitUntilReady()) != ENDPOINT_READYWAIT_NoError)\r
                  return ErrorCode;\r
+\r
+               Endpoint_ClearIN();\r
        }\r
        \r
-       Endpoint_ClearIN();\r
-       return Endpoint_WaitUntilReady();\r
+       return ENDPOINT_READYWAIT_NoError;\r
 }\r
 \r
 uint16_t CDC_Device_BytesReceived(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
index 5905474..605c3b7 100644 (file)
                        /** Flushes any data waiting to be sent, ensuring that the send buffer is cleared.\r
                         *\r
                         *  \param[in,out] CDCInterfaceInfo  Pointer to a structure containing a CDC Class configuration and state.\r
-                        *\r
-                        *  \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum\r
                         */\r
-                       uint8_t CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
+                       void CDC_Device_Flush(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) ATTR_NON_NULL_PTR_ARG(1);\r
                        \r
                        /** Sends a Serial Control Line State Change notification to the host. This should be called when the virtual serial\r
                         *  control lines (DCD, DSR, etc.) have changed states, or to give BREAK notfications to the host. Line states persist\r
index 66dc392..fd67134 100644 (file)
                        /** Receives an asynchronous event block from the device via the asynchronous events pipe.\r
                         *\r
                         *  \param[in,out] SIInterfaceInfo  Pointer to a structure containing a Still Image Class host configuration and state\r
-                        *  \param[out] SI_PIMA_Container_t  Pointer to a PIMA container structure where the event should be stored\r
+                        *  \param[out] PIMAHeader  Pointer to a PIMA container structure where the event should be stored\r
                         *\r
                         *  \return A value from the \ref Pipe_Stream_RW_ErrorCodes_t enum, or \ref SI_ERROR_LOGICAL_CMD_FAILED if the device\r
                         *          returned a logical command failure\r