Fixed incorrect signature reported in the CDC class bootloader for the ATMEGA32U2.
[pub/USBasp.git] / Demos / Host / LowLevel / PrinterHost / Lib / PrinterCommands.c
index 0248959..0b75d75 100644 (file)
@@ -56,11 +56,8 @@ uint8_t Printer_SendData(const void* const PrinterCommands,
          return ErrorCode;
 
        Pipe_ClearOUT();
-       while (!(Pipe_IsOUTReady()))
-       {
-               if (USB_HostState == HOST_STATE_Unattached)
-                 return PIPE_RWSTREAM_DeviceDisconnected;
-       }
+       
+       Pipe_WaitUntilReady();
        
        Pipe_Freeze();
 
@@ -86,7 +83,7 @@ uint8_t Printer_GetDeviceID(char* DeviceIDString,
                        .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
                        .bRequest      = REQ_GetDeviceID,
                        .wValue        = 0,
-                       .wIndex        = 0,
+                       .wIndex        = PrinterInterfaceNumber,
                        .wLength       = sizeof(DeviceIDStringLength),
                };
                
@@ -130,11 +127,11 @@ uint8_t Printer_GetPortStatus(uint8_t* const PortStatus)
 {
        USB_ControlRequest = (USB_Request_Header_t)
                {
-                       bmRequestType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
-                       bRequest:      REQ_GetPortStatus,
-                       wValue:        0,
-                       wIndex:        0,
-                       wLength:       sizeof(uint8_t),
+                       .bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),
+                       .bRequest      = REQ_GetPortStatus,
+                       .wValue        = 0,
+                       .wIndex        = PrinterInterfaceNumber,
+                       .wLength       = sizeof(uint8_t),
                };
 
        Pipe_SelectPipe(PIPE_CONTROLPIPE);
@@ -154,7 +151,7 @@ uint8_t Printer_SoftReset(void)
                        .bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE),
                        .bRequest      = REQ_SoftReset,
                        .wValue        = 0,
-                       .wIndex        = 0,
+                       .wIndex        = PrinterInterfaceNumber,
                        .wLength       = 0,
                };