Fixed HID host Class driver report send/receive report broken when issued through...
authorDean Camera <dean@fourwalledcubicle.com>
Mon, 9 Nov 2009 08:24:01 +0000 (08:24 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Mon, 9 Nov 2009 08:24:01 +0000 (08:24 +0000)
Make Mass Storage device Class driver accept resets at any time, rather than just after a command block has been processed.

Remove the HID device parser from the boot protocol Keyboard/Mouse demos.

Demos/Host/ClassDriver/KeyboardHost/makefile
Demos/Host/ClassDriver/MouseHost/makefile
LUFA/Drivers/USB/Class/Common/HID.h
LUFA/Drivers/USB/Class/Device/MassStorage.c
LUFA/Drivers/USB/Class/Host/HID.c
LUFA/Drivers/USB/Class/Host/HID.h
LUFA/Drivers/USB/Class/Host/HIDParser.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/FutureChanges.txt

index ab4704c..4a682b0 100644 (file)
@@ -137,7 +137,6 @@ SRC = $(TARGET).c                                                 \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c            \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c              \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c        \\r
          \r
 \r
 # List C++ source files here. (C dependencies are automatically generated.)\r
index 9564b74..d37d4d5 100644 (file)
@@ -137,7 +137,6 @@ SRC = $(TARGET).c                                                 \
          $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c  \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/HID.c            \\r
          $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HID.c              \\r
-         $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/HIDParser.c        \\r
          \r
 \r
 # List C++ source files here. (C dependencies are automatically generated.)\r
index 2335126..d53b12f 100644 (file)
                #define HID_BOOT_KEYBOARD_PROTOCOL   0x01\r
 \r
        /* Type Defines: */\r
+               /** Enum for the different types of HID reports. */\r
+               enum HID_ReportItemTypes_t\r
+               {\r
+                       REPORT_ITEM_TYPE_In                   = 1, /**< Indicates that the item is an IN report type. */\r
+                       REPORT_ITEM_TYPE_Out                  = 2, /**< Indicates that the item is an OUT report type. */\r
+                       REPORT_ITEM_TYPE_Feature              = 3, /**< Indicates that the item is a FEATURE report type. */\r
+               };\r
+\r
                /** Type define for the HID class specific HID descriptor, to describe the HID device's specifications. Refer to the HID\r
                 *  specification for details on the structure elements.\r
                 */\r
index fce8643..43dc3f8 100644 (file)
@@ -120,21 +120,21 @@ void MS_Device_USBTask(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)
                        }\r
                        \r
                        MS_Device_ReturnCommandStatus(MSInterfaceInfo);\r
-                       \r
-                       if (MSInterfaceInfo->State.IsMassStoreReset)\r
-                       {\r
-                               Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber);\r
-                               Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber);\r
-                               \r
-                               Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);\r
-                               Endpoint_ClearStall();\r
-                               Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);\r
-                               Endpoint_ClearStall();\r
-                       }\r
                }\r
        }\r
        \r
-       MSInterfaceInfo->State.IsMassStoreReset = false;\r
+       if (MSInterfaceInfo->State.IsMassStoreReset)\r
+       {\r
+               Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataOUTEndpointNumber);\r
+               Endpoint_ResetFIFO(MSInterfaceInfo->Config.DataINEndpointNumber);\r
+               \r
+               Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataOUTEndpointNumber);\r
+               Endpoint_ClearStall();\r
+               Endpoint_SelectEndpoint(MSInterfaceInfo->Config.DataINEndpointNumber);\r
+               Endpoint_ClearStall();\r
+\r
+               MSInterfaceInfo->State.IsMassStoreReset = false;\r
+       }\r
 }\r
 \r
 static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)\r
@@ -165,11 +165,8 @@ static bool MS_Device_ReadInCommandBlock(USB_ClassInfo_MS_Device_t* const MSInte
                                StreamCallback_MS_Device_AbortOnMassStoreReset);\r
                                                        \r
        Endpoint_ClearOUT();\r
-         \r
-       if (MSInterfaceInfo->State.IsMassStoreReset)\r
-         return false;\r
-\r
-       return true;\r
+       \r
+       return !(MSInterfaceInfo->State.IsMassStoreReset);\r
 }\r
 \r
 static void MS_Device_ReturnCommandStatus(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo)\r
index 7d9b3b5..a82fe53 100644 (file)
@@ -162,7 +162,7 @@ uint8_t HID_Host_ReceiveReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceI
        {\r
                .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
                .bRequest      = REQ_SetReport,\r
-               .wValue        = ReportID,\r
+               .wValue        = (REPORT_ITEM_TYPE_In << 8) | ReportID,\r
                .wIndex        = HIDInterfaceInfo->State.InterfaceNumber,\r
                .wLength       = USB_GetHIDReportSize(HIDInterfaceInfo->Config.HIDParserData, ReportID, REPORT_ITEM_TYPE_In),\r
        };\r
@@ -249,7 +249,7 @@ uint8_t HID_Host_SendReportByID(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo
                        .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),\r
                        .bRequest      = REQ_SetReport,\r
 #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)\r
-                       .wValue        = ReportID,\r
+                       .wValue        = (REPORT_ITEM_TYPE_Out << 8) | ReportID,\r
 #else\r
                        .wValue        = 0,\r
 #endif\r
index 89cb3d8..8a70f27 100644 (file)
 \r
 \r
                        /** Receives a HID IN report from the attached HID device, when a report has been received on the HID IN Data pipe.\r
+                        *  \r
+                        *  \note The destination buffer should be large enough to accomodate the largest report that the attached device\r
+                        *        can generate.\r
                         *\r
                         *  \param[in,out] HIDInterfaceInfo  Pointer to a structure containing a HID Class host configuration and state\r
                         *  \param[in] Buffer  Buffer to store the received report into\r
                        uint8_t HID_Host_ReceiveReport(USB_ClassInfo_HID_Host_t* const HIDInterfaceInfo, void* Buffer) ATTR_NON_NULL_PTR_ARG(1, 2);\r
 \r
                        #if !defined(HID_HOST_BOOT_PROTOCOL_ONLY)\r
-                       /** Received a HID IN report from the attached device, by the report ID.\r
+                       /** Receives a HID IN report from the attached device, by the report ID.\r
                         *\r
                         *  \note When the HID_HOST_BOOT_PROTOCOL_ONLY compile time token is defined, this method is unavailable.\r
                         *\r
index 751e40e..d7ef272 100644 (file)
@@ -62,6 +62,7 @@
                #include <stdbool.h>\r
 \r
                #include "HIDReportData.h"\r
+               #include "../Common/HID.h"\r
 \r
                #include "../../../../Common/Common.h"\r
 \r
                #endif\r
 \r
        /* Public Interface - May be used in end-application: */\r
-               /* Enums: */\r
-                       /** Enum for indicating what type of report item an entry in a \ref HID_ReportInfo_t ReportItem array is */\r
-                       enum HID_ReportItemTypes_t\r
-                       {\r
-                               REPORT_ITEM_TYPE_In                   = 0, /**< Indicates that the item is an IN report type. */\r
-                               REPORT_ITEM_TYPE_Out                  = 1, /**< Indicates that the item is an OUT report type. */\r
-                               REPORT_ITEM_TYPE_Feature              = 2, /**< Indicates that the item is a FEATURE report type. */\r
-                       };\r
-                       \r
+               /* Enums: */                    \r
                        /** Enum for the possible error codes in the return value of the \ref USB_ProcessHIDReport() function */\r
                        enum HID_Parse_ErrorCodes_t\r
                        {\r
index 9fe00ee..0dd3496 100644 (file)
@@ -46,6 +46,7 @@
   *  - Fixed HID device class driver not reselecting the correct endpoint once the user callback routines have been called\r
   *  - Corrected HID descriptor in the Joystick Device demos - buttons should be placed outside the pointer collection\r
   *  - Fixed HID report parser collection paths invalid due to misplaced semicolon in the free path item search loop\r
+  *  - Fixed HID host Class driver report send/receive report broken when issued through the control pipe\r
   *\r
   *  \section Sec_ChangeLog090924 Version 090924\r
   *\r
index 60afc3f..750fb15 100644 (file)
@@ -24,7 +24,7 @@
   *  - Add unit testing to APIs\r
   *  - Add board overviews\r
   *  - Add resume interrupt support\r
-  *  - Specification compliance testing for all device demos\r
+  *  - Correct mishandling of error cases in Mass Storage demo\r
   *  - Add RNDIS Host Class driver\r
   *  - Make new demos\r
   *      -# Keyboard/Mouse Dual Class Host\r