Fixed HID report parser collection paths invalid due to misplaced semicolon in the...
authorDean Camera <dean@fourwalledcubicle.com>
Wed, 4 Nov 2009 07:14:38 +0000 (07:14 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Wed, 4 Nov 2009 07:14:38 +0000 (07:14 +0000)
LUFA/Drivers/USB/Class/Host/HIDParser.c
LUFA/Drivers/USB/Class/Host/HIDParser.h
LUFA/ManPages/ChangeLog.txt
LUFA/ManPages/FutureChanges.txt

index f376308..3090774 100644 (file)
@@ -42,16 +42,12 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
        uint16_t              UsageStack[HID_USAGE_STACK_DEPTH];\r
        uint8_t               UsageStackSize          = 0;\r
 \r
-       ParserData->TotalReportItems   = 0;\r
-       ParserData->TotalDeviceReports = 1;\r
-       ParserData->UsingReportIDs     = false;\r
-       \r
-       for (uint8_t CurrCollection = 0; CurrCollection < HID_MAX_COLLECTIONS; CurrCollection++)\r
-         ParserData->CollectionPaths[CurrCollection].Parent = NULL;\r
-\r
+       memset(ParserData,       0x00, sizeof(HID_ReportInfo_t));\r
        memset(CurrStateTable,   0x00, sizeof(HID_StateTable_t));\r
        memset(CurrReportIDInfo, 0x00, sizeof(HID_ReportSizeInfo_t));\r
 \r
+       ParserData->TotalDeviceReports = 1;     \r
+\r
        while (ReportSize)\r
        {\r
                uint8_t  HIDReportItem  = *ReportData;\r
@@ -177,7 +173,7 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                        \r
                                        CurrCollectionPath = &ParserData->CollectionPaths[1];\r
 \r
-                                       while (CurrCollectionPath->Parent != NULL);\r
+                                       while (CurrCollectionPath->Parent != NULL)\r
                                        {\r
                                                if (CurrCollectionPath == &ParserData->CollectionPaths[HID_MAX_COLLECTIONS - 1])\r
                                                  return HID_PARSE_InsufficientCollectionPaths;\r
@@ -200,10 +196,6 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                          \r
                                        UsageStackSize--;\r
                                }\r
-                               else\r
-                               {\r
-                                       CurrCollectionPath->Usage.Usage = 0;\r
-                               }\r
                                \r
                                break;\r
                        case (TYPE_MAIN | TAG_MAIN_ENDCOLLECTION):\r
@@ -211,7 +203,6 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                  return HID_PARSE_UnexpectedEndCollection;\r
                \r
                                CurrCollectionPath = CurrCollectionPath->Parent;\r
-\r
                                break;\r
                        case (TYPE_MAIN | TAG_MAIN_INPUT):\r
                        case (TYPE_MAIN | TAG_MAIN_OUTPUT):\r
@@ -237,39 +228,26 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                                  \r
                                                UsageStackSize--;\r
                                        }\r
-                                       else\r
-                                       {\r
-                                               NewReportItem.Attributes.Usage.Usage = 0;\r
-                                       }\r
-\r
-                                       uint8_t ReportSizeIndex = 0;\r
 \r
                                        switch (HIDReportItem & TAG_MASK)\r
                                        {\r
                                                case TAG_MAIN_INPUT:\r
                                                        NewReportItem.ItemType  = REPORT_ITEM_TYPE_In;\r
-                                                       NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_In];\r
-                                                               \r
-                                                       ReportSizeIndex = REPORT_ITEM_TYPE_In;\r
                                                        break;\r
                                                case TAG_MAIN_OUTPUT:\r
                                                        NewReportItem.ItemType  = REPORT_ITEM_TYPE_Out;\r
-                                                       NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Out];\r
-                                                               \r
-                                                       ReportSizeIndex = REPORT_ITEM_TYPE_Out;\r
                                                        break;\r
                                                case TAG_MAIN_FEATURE:\r
                                                        NewReportItem.ItemType  = REPORT_ITEM_TYPE_Feature;                                             \r
-                                                       NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Feature];\r
-                                                               \r
-                                                       ReportSizeIndex = REPORT_ITEM_TYPE_Feature;\r
                                                        break;\r
                                        }\r
                                        \r
-                                       CurrReportIDInfo->ReportSizeBits[ReportSizeIndex] += CurrStateTable->Attributes.BitSize;\r
+                                       NewReportItem.BitOffset = CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType];\r
+\r
+                                       CurrReportIDInfo->ReportSizeBits[NewReportItem.ItemType] += CurrStateTable->Attributes.BitSize;\r
 \r
-                                       if (ParserData->LargestReportSizeBits < CurrReportIDInfo->ReportSizeBits[ReportSizeIndex])\r
-                                         ParserData->LargestReportSizeBits = CurrReportIDInfo->ReportSizeBits[ReportSizeIndex];\r
+                                       if (ParserData->LargestReportSizeBits < NewReportItem.BitOffset)\r
+                                         ParserData->LargestReportSizeBits = NewReportItem.BitOffset;\r
                                        \r
                                        if (!(ReportItemData & IOF_CONSTANT) && CALLBACK_HIDParser_FilterHIDReportItem(&NewReportItem))\r
                                        {                                       \r
@@ -283,8 +261,6 @@ uint8_t USB_ProcessHIDReport(const uint8_t* ReportData, uint16_t ReportSize, HID
                                        }\r
                                }\r
                                \r
-                               UsageStackSize = 0;\r
-                               \r
                                break;\r
                }\r
          \r
index de98967..7a1563a 100644 (file)
@@ -99,7 +99,7 @@
                         *  overridden by defining HID_MAX_COLLECTIONS to another value in the user project makefile, passing\r
                         *  the define to the compiler using the -D compiler switch.\r
                         */\r
-                       #define HID_MAX_COLLECTIONS           5\r
+                       #define HID_MAX_COLLECTIONS           10\r
                #endif\r
                \r
                #if !defined(HID_MAX_REPORTITEMS) || defined(__DOXYGEN__)\r
index 3e2ce86..38e6e89 100644 (file)
@@ -42,6 +42,7 @@
   *  - Fixed incorrect event name rule in demo/project/bootloader makefiles\r
   *  - 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
   *\r
   *  \section Sec_ChangeLog090924 Version 090924\r
   *\r
index 45e24aa..1e2eaa7 100644 (file)
@@ -27,7 +27,6 @@
   *  - Make new demos\r
   *      -# Keyboard/Mouse Dual Class Host\r
   *      -# Multiple-Report HID device\r
-  *      -# Joystick Host\r
   *  - Port LUFA to other architectures\r
   *      -# AVR32 UC3B series microcontrollers\r
   *      -# Atmel ARM7 series microcontrollers\r