Add new Audio Class Driver Host demos.
[pub/USBasp.git] / Demos / Host / LowLevel / PrinterHost / PrinterHost.c
index e468cc6..6265eee 100644 (file)
@@ -103,7 +103,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
 /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
 void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 {
 /** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
 void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
 {
-       USB_ShutDown();
+       USB_Disable();
 
        printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
                                 " -- 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);
@@ -177,16 +177,7 @@ void USB_Printer_Host(void)
                         * request to switch to the interface alternate setting with the Bidirectional protocol */
                        if (PrinterAltSetting)
                        {
                         * request to switch to the interface alternate setting with the Bidirectional protocol */
                        if (PrinterAltSetting)
                        {
-                               USB_ControlRequest = (USB_Request_Header_t)
-                                       {
-                                               .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE),
-                                               .bRequest      = REQ_SetInterface,
-                                               .wValue        = PrinterAltSetting,
-                                               .wIndex        = PrinterInterfaceNumber,
-                                               .wLength       = 0,
-                                       };
-
-                               if ((ErrorCode = USB_Host_SendControlRequest(NULL)) != HOST_SENDCONTROL_Successful)
+                               if ((ErrorCode = USB_Host_SetInterfaceAltSetting(PrinterInterfaceNumber, PrinterAltSetting)) != HOST_SENDCONTROL_Successful)
                                {
                                        printf_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"
                                                                 " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);
                                {
                                        printf_P(PSTR(ESC_FG_RED "Control Error (Set Interface).\r\n"
                                                                 " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);