Make Endpoint control transfers more reliable; early-abort when an incomplete packet...
[pub/lufa.git] / Demos / Host / LowLevel / PrinterHost / PrinterHost.c
index bd84f19..b2b4059 100644 (file)
@@ -101,8 +101,8 @@ void EVENT_USB_Host_HostError(uint8_t ErrorCode)
 {\r
        USB_ShutDown();\r
 \r
-       puts_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+       printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"\r
+                                " -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
        for(;;);\r
@@ -113,10 +113,10 @@ void EVENT_USB_Host_HostError(uint8_t ErrorCode)
  */\r
 void EVENT_USB_Host_DeviceEnumerationFailed(uint8_t ErrorCode, uint8_t SubErrorCode)\r
 {\r
-       puts_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"));\r
-       printf_P(PSTR(" -- Error Code %d\r\n"), ErrorCode);\r
-       printf_P(PSTR(" -- Sub Error Code %d\r\n"), SubErrorCode);\r
-       printf_P(PSTR(" -- In State %d\r\n" ESC_FG_WHITE), USB_HostState);\r
+       printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"\r
+                                " -- Error Code %d\r\n"\r
+                                " -- Sub Error Code %d\r\n"\r
+                                " -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);\r
 \r
        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
 }\r
@@ -157,8 +157,8 @@ void USB_Printer_Host(void)
                        /* Set the device configuration to the first configuration (rarely do devices use multiple configurations) */\r
                        if ((ErrorCode = USB_Host_SetDeviceConfiguration(1)) != HOST_SENDCONTROL_Successful)\r
                        {\r
-                               puts_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"));\r
-                               printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                               printf_P(PSTR(ESC_FG_RED "Control Error (Set Configuration).\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                /* Indicate error via status LEDs */\r
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
@@ -183,8 +183,8 @@ void USB_Printer_Host(void)
                                        \r
                                if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)\r
                                {\r
-                                       puts_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"));\r
-                                       printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                                       printf_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"\r
+                                                                " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                        /* Indicate error via status LEDs */\r
                                        LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
@@ -200,8 +200,8 @@ void USB_Printer_Host(void)
                        char DeviceIDString[256];\r
                        if ((ErrorCode = Printer_GetDeviceID(DeviceIDString, sizeof(DeviceIDString))) != HOST_SENDCONTROL_Successful)\r
                        {\r
-                               puts_P(PSTR(ESC_FG_RED "Control Error (Get DeviceID).\r\n"));\r
-                               printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                               printf_P(PSTR(ESC_FG_RED "Control Error (Get DeviceID).\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                /* Indicate error via status LEDs */\r
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
@@ -231,8 +231,8 @@ void USB_Printer_Host(void)
 \r
                        if ((ErrorCode = Printer_SendData(&TestPageData)) != PIPE_RWSTREAM_NoError)\r
                        {\r
-                               puts_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n"));\r
-                               printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
+                               printf_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n"\r
+                                                        " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);\r
 \r
                                /* Indicate error via status LEDs */\r
                                LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r