From 849b9535e7f4ca84aa909cfb9e985ae29f14be72 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Tue, 22 Sep 2009 08:07:48 +0000 Subject: 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. --- .../LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c | 8 ++++++-- Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'Demos/Host/LowLevel') diff --git a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c index 3b97ad7ed..0cba5fccd 100644 --- a/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/LowLevel/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -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; diff --git a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c index 4d50ff6ab..b47858e31 100644 --- a/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/LowLevel/MouseHostWithParser/MouseHostWithParser.c @@ -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; -- cgit v1.2.3