Change HID report parser so that it can calculate and record the sizes (IN, OUT and...
[pub/lufa.git] / Demos / Host / LowLevel / MouseHostWithParser / MouseHostWithParser.c
index 69ba64b..670cab9 100644 (file)
@@ -181,6 +181,20 @@ void Mouse_HID_Task(void)
                                USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
                                break;\r
                        }\r
+                       \r
+                       printf("Total Reports: %d\r\n", HIDReportInfo.TotalDeviceReports);\r
+\r
+                       for (uint8_t i = 0; i < HIDReportInfo.TotalDeviceReports; i++)\r
+                       {\r
+                               HID_ReportSizeInfo_t* CurrReportIDInfo = &HIDReportInfo.ReportIDSizes[i];\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
+                       }\r
 \r
                        puts_P(PSTR("Mouse Enumerated.\r\n"));\r
 \r
@@ -190,7 +204,7 @@ void Mouse_HID_Task(void)
                        /* Select and unfreeze mouse data pipe */\r
                        Pipe_SelectPipe(MOUSE_DATAPIPE);        \r
                        Pipe_Unfreeze();\r
-\r
+                       \r
                        /* Check to see if a packet has been received */\r
                        if (Pipe_IsINReceived())\r
                        {\r