#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying\r
- * storage media (Dataflash) using a different native block size.\r
+ * storage media (Dataflash) using a different native block size. Do not change this value.\r
*/\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512\r
\r
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */\r
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not\r
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.\r
+ */\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)\r
\r
/* Function Prototypes: */\r
#define VIRTUAL_MEMORY_BYTES ((uint32_t)DATAFLASH_PAGES * DATAFLASH_PAGE_SIZE * DATAFLASH_TOTALCHIPS)\r
\r
/** Block size of the device. This is kept at 512 to remain compatible with the OS despite the underlying\r
- * storage media (Dataflash) using a different native block size.\r
+ * storage media (Dataflash) using a different native block size. Do not change this value.\r
*/\r
#define VIRTUAL_MEMORY_BLOCK_SIZE 512\r
\r
- /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. */\r
+ /** Total number of blocks of the virtual memory for reporting to the host as the device's total capacity. Do not\r
+ * change this value; change VIRTUAL_MEMORY_BYTES instead to alter the media size.\r
+ */\r
#define VIRTUAL_MEMORY_BLOCKS (VIRTUAL_MEMORY_BYTES / VIRTUAL_MEMORY_BLOCK_SIZE)\r
\r
/* Function Prototypes: */\r
\r
if (USB_HID_Host_SetReportProtocol(&Keyboard_HID_Interface) != 0)\r
{\r
- printf("Could not Set Report Protocol Mode.\r\n");\r
+ printf("Error Setting Report Protocol Mode or Not a Valid Keyboard.\r\n");\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
\r
- printf("HID Device Enumerated.\r\n");\r
+ printf("Keyboard Enumerated.\r\n");\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
\r
if (USB_HID_Host_SetReportProtocol(&Mouse_HID_Interface) != 0)\r
{\r
- printf("Could not Set Report Protocol Mode.\r\n");\r
+ printf("Error Setting Report Protocol Mode or Not a Valid Mouse.\r\n");\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
USB_HostState = HOST_STATE_WaitForDeviceRemoval;\r
break;\r
\r
LEDs_SetAllLEDs(LEDS_NO_LEDS);\r
\r
- printf("HID Device Enumerated.\r\n");\r
+ printf("Mouse Enumerated.\r\n");\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
case HOST_STATE_Configured:\r
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)\r
{\r
puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));\r
- printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+\r
+ if (!(HIDReportInfo->TotalReportItems))\r
+ puts_P(PSTR("Not a valid Keyboard." ESC_FG_WHITE));\r
+ else\r
+ printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
\r
/* Indicate error via status LEDs */\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));\r
}\r
\r
- puts_P(PSTR("HID Device Enumerated.\r\n"));\r
+ puts_P(PSTR("Keyboard Enumerated.\r\n"));\r
\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
/* Get and process the device's first HID report descriptor */\r
if ((ErrorCode = GetHIDReportData()) != ParseSuccessful)\r
{\r
- printf_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"\r
- " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+ puts_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"));\r
+\r
+ if (!(HIDReportInfo->TotalReportItems))\r
+ puts_P(PSTR("Not a valid Mouse." ESC_FG_WHITE));\r
+ else\r
+ printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
\r
/* Indicate error via status LEDs */\r
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
((ReportSizeFeatureBits >> 3) + ((ReportSizeFeatureBits & 0x07) != 0)));\r
}\r
\r
- puts_P(PSTR("HID Device Enumerated.\r\n"));\r
+ puts_P(PSTR("Mouse Enumerated.\r\n"));\r
\r
USB_HostState = HOST_STATE_Configured;\r
break;\r
}\r
}\r
\r
+ if (!(ParserData->TotalReportItems))\r
+ return HID_PARSE_NoUnfilteredReportItems;\r
+ \r
return HID_PARSE_Successful;\r
}\r
\r
HID_PARSE_InsufficientCollectionPaths = 5, /**< More than \ref HID_MAX_COLLECTIONS collections in the report. */\r
HID_PARSE_UsageStackOverflow = 6, /**< More than \ref HID_USAGE_STACK_DEPTH usages listed in a row. */\r
HID_PARSE_InsufficientReportIDItems = 7, /**< More than \ref HID_MAX_REPORT_IDS report IDs in the device. */\r
+ HID_PARSE_NoUnfilteredReportItems = 8, /**< All report items from the device were filtered by the filtering callback routine. */\r
};\r
\r
/* Type Defines: */ \r