Added flag to the HID report parser to indicate if a device has multiple reports.
authorDean Camera <dean@fourwalledcubicle.com>
Tue, 11 Aug 2009 11:19:22 +0000 (11:19 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Tue, 11 Aug 2009 11:19:22 +0000 (11:19 +0000)
SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested HID interface within the device, not all HID interfaces.

Apply correct fix to the HID report parser for PUSH items - current HID item attribute stack was being copied in the wrong direction.

Fixed HID report parser not resetting the FEATURE item count when a REPORT ID item is encountered.

LUFA/Drivers/USB/Class/Device/HID.c
LUFA/Drivers/USB/Class/Host/HIDParser.c
LUFA/Drivers/USB/Class/Host/HIDParser.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/FutureChanges.txt

index 937214b..0cbd50a 100644 (file)
@@ -38,11 +38,8 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
        if (!(Endpoint_IsSETUPReceived()))\r
          return;\r
          \r
-       if ((USB_ControlRequest.wIndex   != HIDInterfaceInfo->Config.InterfaceNumber) &&\r
-           (USB_ControlRequest.bRequest != REQ_SetIdle))\r
-       {\r
-               return;\r
-       }\r
+       if (USB_ControlRequest.wIndex != HIDInterfaceInfo->Config.InterfaceNumber)\r
+         return;\r
 \r
        switch (USB_ControlRequest.bRequest)\r
        {\r
@@ -106,15 +103,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
                case REQ_SetIdle:\r
                        if (USB_ControlRequest.bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
                        {\r
-                               if ((USB_ControlRequest.wIndex         == HIDInterfaceInfo->Config.InterfaceNumber) ||\r
-                                   (USB_ControlRequest.wValue & 0xFF) == 0)\r
-                               {\r
-                                       Endpoint_ClearSETUP();\r
+                               Endpoint_ClearSETUP();\r
                                        \r
-                                       HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);\r
+                               HIDInterfaceInfo->State.IdleCount = ((USB_ControlRequest.wValue & 0xFF00) >> 6);\r
                                        \r
-                                       Endpoint_ClearStatusStage();\r
-                               }\r
+                               Endpoint_ClearStatusStage();\r
                        }\r
                        \r
                        break;\r
index 7ec003f..fdce8e5 100644 (file)
@@ -81,8 +81,8 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                if (CurrStateTable == &StateTable[HID_STATETABLE_STACK_DEPTH - 1])\r
                                  return HID_PARSE_HIDStackOverflow;\r
        \r
-                               memcpy(CurrStateTable,\r
-                                      (CurrStateTable + 1),\r
+                               memcpy((CurrStateTable + 1),\r
+                                      CurrStateTable,\r
                                       sizeof(HID_ReportItem_t));\r
 \r
                                CurrStateTable++;\r
@@ -122,8 +122,13 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                break;\r
                        case (TYPE_GLOBAL | TAG_GLOBAL_REPORTID):\r
                                CurrStateTable->ReportID                    = ReportItemData;\r
-                               BitOffsetIn  = 0;\r
-                               BitOffsetOut = 0;\r
+                               ParserData->UsingMultipleReports = true;\r
+                               BitOffsetIn      = 0;\r
+                               BitOffsetOut     = 0;\r
+\r
+                               #if defined(HID_ENABLE_FEATURE_PROCESSING)\r
+                               BitOffsetFeature = 0;\r
+                               #endif\r
                                break;\r
                        case (TYPE_LOCAL | TAG_LOCAL_USAGE):\r
                                if (UsageStackSize == HID_USAGE_STACK_DEPTH)\r
index a9fff3e..942fe11 100644 (file)
                        typedef struct\r
                        {\r
                                uint8_t                      TotalReportItems; /**< Total number of report items stored in the\r
-                                                                               *   ReportItems array. */\r
-\r
+                                                                               *   ReportItems array.\r
+                                                                               */\r
                                HID_ReportItem_t             ReportItems[HID_MAX_REPORTITEMS]; /**< Report items array, including\r
-                                                                                           *   all IN, OUT and FEATURE items. */\r
-\r
+                                                                                           *   all IN, OUT and FEATURE items.\r
+                                                                                               */\r
                                HID_CollectionPath_t         CollectionPaths[HID_MAX_COLLECTIONS]; /**< All collection items, referenced\r
-                                                                                                   *   by the report items. */\r
+                                                                                                   *   by the report items.\r
+                                                                                                   */\r
+                               bool                         UsingMultipleReports; /**< Indicates if the device has at least one REPORT ID\r
+                                                                                   *   element in its HID report descriptor.\r
+                                                                                   */\r
                        } HID_ReportInfo_t;\r
                        \r
                /* Function Prototypes: */\r
                         *  buffer. The report buffer is assumed to have the appropriate bits cleared before calling\r
                         *  this function (i.e., the buffer should be explicitly cleared before report values are added).\r
                         *\r
-                        *  If the device has multiple HID reports, the report ID is set to the report ID of the given item.\r
+                        *  If the device has multiple HID reports, the first byte in the report is set to the report ID of the given item.\r
                         *\r
-                        *  \param[out] ReportData  Buffer holding the current OUT report data\r
+                        *  \param[out] ReportData  Buffer holding the current OUT or FEATURE report data\r
                         *  \param[in] ReportItem  Pointer to the report item of interest in a \ref HID_ReportInfo_t ReportItem array\r
                         */\r
                        void USB_SetHIDReportItemInfo(uint8_t* ReportData, const HID_ReportItem_t* ReportItem)\r
index a6ed06c..059734f 100644 (file)
   *\r
   *  <b>New:</b>\r
   *  - Added new host class drivers and matching demos to the library for rapid application development\r
+  *  - Added flag to the HID report parser to indicate if a device has multiple reports\r
   *  \r
   *  <b>Changed:</b>\r
+  *  - SetIdle requests to the HID device driver with a 0 idle period (send changes only) now only affect the requested\r
+  *    HID interface within the device, not all HID interfaces.\r
   *\r
   *  <b>Fixed:</b>\r
   *  - Fixed possible lockup in the CDC device class driver, when the host sends data that is a multiple of the\r
   *    endpoint's bank\r
   *  - Fixed swapped paremeters in the HID state memory copy call while processing a HID PUSH item in the HID report parser\r
   *  - Fixed memory corruption HID report parser when too many COLLECTION or PUSH items were processed\r
+  *  - Fixed HID report parser not resetting the FEATURE item count when a REPORT ID item is encountered\r
   *\r
   *\r
   *  \section Sec_ChangeLog090810 Version 090810\r
index e69103e..319e95d 100644 (file)
@@ -18,6 +18,8 @@
   *     -# Convert Host mode demos to class drivers\r
   *     -# Re-enable Host mode Class driver builds after completion\r
   *     -# Update Host mode Class Driver demo .txt files\r
+  *  - Add overviews of each of the officially supported boards to the manual\r
+  *  - Add hub support to match Atmel's stack\r
   *\r
   *  <b>Targeted for Future Releases:</b>\r
   *  - Add standardized descriptor names to device and host class driver structures\r
@@ -26,7 +28,6 @@
   *  - Master LUFA include file rather than per-module includes\r
   *  - Add multiple-report HID demo to the library\r
   *  - Add dual role Mouse Host/Keyboard Device demo to the library\r
-  *  - Add hub support to match Atmel's stack\r
   *  - Change makefiles to allow for absolute LUFA location to be used\r
   *  - Port LUFA to other architectures\r
   *      -# AVR32 UC3B series microcontrollers\r