Fix low level host mode demos not correctly fetching the next endpoint when an invali...
[pub/USBasp.git] / Demos / Host / ClassDriver / KeyboardHostWithParser / KeyboardHostWithParser.c
index dedf12f..3fd23f0 100644 (file)
@@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
                                .DataOUTPipeNumber      = 2,
                                .DataOUTPipeDoubleBank  = false,
                                
                                .DataOUTPipeNumber      = 2,
                                .DataOUTPipeDoubleBank  = false,
                                
-                               .HIDInterfaceProtocol   = HID_NON_BOOT_PROTOCOL,
+                               .HIDInterfaceProtocol   = HID_BOOTP_NonBootProtocol,
                                
                                .HIDParserData          = &HIDReportInfo
                        },
                                
                                .HIDParserData          = &HIDReportInfo
                        },
@@ -138,12 +138,12 @@ int main(void)
                                                if ((ReportItem->Attributes.Usage.Page      == USAGE_PAGE_KEYBOARD) &&
                                                        (ReportItem->Attributes.BitSize         == 8)                   &&
                                                        (ReportItem->Attributes.Logical.Maximum > 1)                    &&
                                                if ((ReportItem->Attributes.Usage.Page      == USAGE_PAGE_KEYBOARD) &&
                                                        (ReportItem->Attributes.BitSize         == 8)                   &&
                                                        (ReportItem->Attributes.Logical.Maximum > 1)                    &&
-                                                       (ReportItem->ItemType                   == REPORT_ITEM_TYPE_In))
+                                                       (ReportItem->ItemType                   == HID_REPORT_ITEM_In))
                                                {
                                                        /* Key code is an unsigned char in length, cast to the appropriate type */
                                                        uint8_t KeyCode = (uint8_t)ReportItem->Value;
 
                                                {
                                                        /* Key code is an unsigned char in length, cast to the appropriate type */
                                                        uint8_t KeyCode = (uint8_t)ReportItem->Value;
 
-                                                       /* If scancode is non-zero, a key is being pressed */
+                                                       /* If scan-code is non-zero, a key is being pressed */
                                                        if (KeyCode)
                                                        {
                                                                /* Toggle status LED to indicate keypress */
                                                        if (KeyCode)
                                                        {
                                                                /* Toggle status LED to indicate keypress */
@@ -151,7 +151,7 @@ int main(void)
 
                                                                char PressedKey = 0;
 
 
                                                                char PressedKey = 0;
 
-                                                               /* Convert scancode to printable character if alphanumeric */
+                                                               /* Convert scan-code to printable character if alphanumeric */
                                                                if ((KeyCode >= 0x04) && (KeyCode <= 0x1D))
                                                                  PressedKey = (KeyCode - 0x04) + 'A';
                                                                else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
                                                                if ((KeyCode >= 0x04) && (KeyCode <= 0x1D))
                                                                  PressedKey = (KeyCode - 0x04) + 'A';
                                                                else if ((KeyCode >= 0x1E) && (KeyCode <= 0x27))
@@ -166,7 +166,7 @@ int main(void)
                                                                  putchar(PressedKey);
                                                        }
                                                        
                                                                  putchar(PressedKey);
                                                        }
                                                        
-                                                       /* Once a scancode is found, stop scanning through the report items */
+                                                       /* Once a scan-code is found, stop scanning through the report items */
                                                        break;
                                                }
                                        }
                                                        break;
                                                }
                                        }
@@ -237,7 +237,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
  *  enumerating an attached USB device.
  */
 /** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
  *  enumerating an attached USB device.
  */
-void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
+void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
+                                            const uint8_t SubErrorCode)
 {
        printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
                                 " -- Error Code %d\r\n"
 {
        printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
                                 " -- Error Code %d\r\n"
@@ -256,7 +257,7 @@ void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8
  *
  *  \return Boolean true if the item should be stored into the HID report structure, false if it should be discarded
  */
  *
  *  \return Boolean true if the item should be stored into the HID report structure, false if it should be discarded
  */
-bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* CurrentItem)
+bool CALLBACK_HIDParser_FilterHIDReportItem(HID_ReportItem_t* const CurrentItem)
 {
        /* Check the attributes of the current item - see if we are interested in it or not;
         * only store KEYBOARD usage page items into the Processed HID Report structure to
 {
        /* Check the attributes of the current item - see if we are interested in it or not;
         * only store KEYBOARD usage page items into the Processed HID Report structure to