Add new attributes to the HID Report Parser and HID Host Mode Class driver to keep...
[pub/lufa.git] / Demos / Host / LowLevel / MouseHostWithParser / MouseHostWithParser.c
index 670cab9..4d50ff6 100644 (file)
@@ -187,16 +187,20 @@ void Mouse_HID_Task(void)
                        for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)\r
                        {\r
                                HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];\r
                        for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)\r
                        {\r
                                HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];\r
+                               \r
+                               uint8_t ReportSizeInBits      = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_In];\r
+                               uint8_t ReportSizeOutBits     = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Out];\r
+                               uint8_t ReportSizeFeatureBits = CurrReportIDInfo->ReportSizeBits[REPORT_ITEM_TYPE_Feature];\r
 \r
                                /* Print out the byte sizes of each report within the device */\r
                                printf_P(PSTR("  + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),\r
 \r
                                /* Print out the byte sizes of each report within the device */\r
                                printf_P(PSTR("  + Report ID %d - In: %d bytes, Out: %d bytes, Feature: %d bytes\r\n"),\r
-                                                          CurrReportIDInfo->ReportID,\r
-                                                          ((CurrReportIDInfo->BitsIn >> 3)      + (CurrReportIDInfo->BitsIn & 0x07)),\r
-                                                          ((CurrReportIDInfo->BitsOut >> 3)     + (CurrReportIDInfo->BitsOut & 0x07)),\r
-                                                          ((CurrReportIDInfo->BitsFeature >> 3) + (CurrReportIDInfo->BitsFeature & 0x07)));\r
+                                        CurrReportIDInfo->ReportID,\r
+                                        ((ReportSizeInBits      >> 3) + ((ReportSizeInBits      & 0x07) != 0)),\r
+                                        ((ReportSizeOutBits     >> 3) + ((ReportSizeOutBits     & 0x07) != 0)),\r
+                                        ((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));\r
                        }\r
 \r
                        }\r
 \r
-                       puts_P(PSTR("Mouse Enumerated.\r\n"));\r
+                       puts_P(PSTR("HID Device Enumerated.\r\n"));\r
 \r
                        USB_HostState = HOST_STATE_Configured;\r
                        break;\r
 \r
                        USB_HostState = HOST_STATE_Configured;\r
                        break;\r
@@ -248,8 +252,8 @@ void ProcessMouseReport(uint8_t* MouseReport)
                \r
                bool FoundData;\r
 \r
                \r
                bool FoundData;\r
 \r
-               if ((ReportItem->Attributes.Usage.Page       == USAGE_PAGE_BUTTON) &&\r
-                       (ReportItem->ItemType                    == REPORT_ITEM_TYPE_In))\r
+               if ((ReportItem->Attributes.Usage.Page        == USAGE_PAGE_BUTTON) &&\r
+                       (ReportItem->ItemType                     == REPORT_ITEM_TYPE_In))\r
                {\r
                        /* Get the mouse button value */\r
                        FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);\r
                {\r
                        /* Get the mouse button value */\r
                        FoundData = USB_GetHIDReportItemInfo(MouseReport, ReportItem);\r