Fixed Low Level USBtoSerial demo not storing received characters (thanks to Michael...
[pub/USBasp.git] / Demos / Host / LowLevel / KeyboardHostWithParser / KeyboardHostWithParser.c
index ef73b77..3e6aa28 100644 (file)
@@ -101,8 +101,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 {\r
        USB_ShutDown();\r
 \r
-       puts_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+       printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"\r
+                                " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
        for(;;);\r
@@ -113,10 +113,10 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
  */\r
 void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)\r
 {\r
-       puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
-       printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);\r
-       printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);\r
+       printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"\r
+                                " -- Error Code %d\r\n"\r
+                                " -- Sub Error Code %d\r\n"\r
+                                " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);\r
        \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
@@ -166,8 +166,8 @@ void Keyboard_HID_Task(void)
                                break;\r
                        }\r
                                \r
-                       puts_P(PSTR("Processing HID Report.\r\n"));\r
-\r
+                       printf_P(PSTR("Processing HID Report (Size %d Bytes).\r\n"), HIDReportSize);\r
+                                               \r
                        /* Get and process the device's first HID report descriptor */\r
                        if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)\r
                        {\r
@@ -182,6 +182,20 @@ void Keyboard_HID_Task(void)
                                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("Keyboard Enumerated.\r\n"));\r
 \r
                        USB_HostState = HOST_STATE_Configured;\r