Make Endpoint control transfers more reliable; early-abort when an incomplete packet is sent from the host (indicating end of transfer), add check for control reads to ensure that no more than wLength bytes are read from the interface.
Condense sequential printf_P/puts_P calls to single printf_P calls for size and clarity.
This commit is contained in:
parent
3848482532
commit
c830fcb0e1
14 changed files with 129 additions and 118 deletions
|
@ -101,8 +101,8 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
|
|||
{
|
||||
USB_ShutDown();
|
||||
|
||||
puts_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"));
|
||||
printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
|
||||
" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
for(;;);
|
||||
|
@ -113,10 +113,10 @@ void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
|
|||
*/
|
||||
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode, const uint8_t SubErrorCode)
|
||||
{
|
||||
puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));
|
||||
printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);
|
||||
printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);
|
||||
printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);
|
||||
printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
|
||||
" -- Error Code %d\r\n"
|
||||
" -- Sub Error Code %d\r\n"
|
||||
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
|
||||
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
}
|
||||
|
@ -155,8 +155,8 @@ void Mouse_HID_Task(void)
|
|||
/* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */
|
||||
if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)
|
||||
{
|
||||
puts_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"));
|
||||
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"
|
||||
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
/* Indicate error via status LEDs */
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
|
@ -171,8 +171,8 @@ void Mouse_HID_Task(void)
|
|||
/* Get and process the device's first HID report descriptor */
|
||||
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);
|
||||
printf_P(PSTR(ESC_FG_RED "Report Parse Error.\r\n"
|
||||
" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
|
||||
|
||||
/* Indicate error via status LEDs */
|
||||
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue