Added flag to the HID report parser to indicate if a device has multiple reports.
[pub/USBasp.git] / LUFA / Drivers / USB / Class / Host / HIDParser.c
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