Add new error condition to the HID Report Parser for when a report is parsed but no unfiltered items are encountered (i.e. nothing of interest in the device report). Make all host HID "WithParser" demos print the new error condition.
This commit is contained in:
parent
576f40f5ae
commit
849b9535e7
8 changed files with 29 additions and 13 deletions
|
|
@ -106,7 +106,7 @@ int main(void)
|
|||
|
||||
if (USB_HID_Host_SetReportProtocol(&Keyboard_HID_Interface) != 0)
|
||||
{
|
||||
printf("Could not Set Report Protocol Mode.\r\n");
|
||||
printf("Error Setting Report Protocol Mode or Not a Valid Keyboard.\r\n");
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
|
||||
break;
|
||||
|
|
@ -114,7 +114,7 @@ int main(void)
|
|||
|
||||
LEDs_SetAllLEDs(LEDS_NO_LEDS);
|
||||
|
||||
printf("HID Device Enumerated.\r\n");
|
||||
printf("Keyboard Enumerated.\r\n");
|
||||
USB_HostState = HOST_STATE_Configured;
|
||||
break;
|
||||
case HOST_STATE_Configured:
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ int main(void)
|
|||
|
||||
if (USB_HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0)
|
||||
{
|
||||
printf("Could not Set Report Protocol Mode.\r\n");
|
||||
printf("Error Setting Report Protocol Mode or Not a Valid Mouse.\r\n");
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
|
||||
break;
|
||||
|
|
@ -114,7 +114,7 @@ int main(void)
|
|||
|
||||
LEDs_SetAllLEDs(LEDS_NO_LEDS);
|
||||
|
||||
printf("HID Device Enumerated.\r\n");
|
||||
printf("Mouse Enumerated.\r\n");
|
||||
USB_HostState = HOST_STATE_Configured;
|
||||
break;
|
||||
case HOST_STATE_Configured:
|
||||
|
|
|
|||
|
|
@ -172,7 +172,11 @@ void Keyboard_HID_Task(void)
|
|||
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
|
||||
{
|
||||
puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));
|
||||
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
if (!(HIDReportInfo->TotalReportItems))
|
||||
puts_P(PSTR("Not a valid Keyboard." ESC_FG_WHITE));
|
||||
else
|
||||
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
/* Indicate error via status LEDs */
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
|
|
@ -200,7 +204,7 @@ void Keyboard_HID_Task(void)
|
|||
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
|
||||
}
|
||||
|
||||
puts_P(PSTR("HID Device Enumerated.\r\n"));
|
||||
puts_P(PSTR("Keyboard Enumerated.\r\n"));
|
||||
|
||||
USB_HostState = HOST_STATE_Configured;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -171,8 +171,12 @@ void Mouse_HID_Task(void)
|
|||
/* Get and process the device's first HID report descriptor */
|
||||
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)
|
||||
{
|
||||
printf_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"
|
||||
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));
|
||||
|
||||
if (!(HIDReportInfo->TotalReportItems))
|
||||
puts_P(PSTR("Not a valid Mouse." ESC_FG_WHITE));
|
||||
else
|
||||
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
/* Indicate error via status LEDs */
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
|
|
@ -200,7 +204,7 @@ void Mouse_HID_Task(void)
|
|||
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));
|
||||
}
|
||||
|
||||
puts_P(PSTR("HID Device Enumerated.\r\n"));
|
||||
puts_P(PSTR("Mouse Enumerated.\r\n"));
|
||||
|
||||
USB_HostState = HOST_STATE_Configured;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue