X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c830fcb0e1d42c1300ebe78a8b33924054b63a87..05fcf7e2a79bebb978d4aeaef26b12f70c6826f8:/Demos/Host/LowLevel/PrinterHost/PrinterHost.c?ds=sidebyside diff --git a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c index b2b4059e9..7c1876fe0 100644 --- a/Demos/Host/LowLevel/PrinterHost/PrinterHost.c +++ b/Demos/Host/LowLevel/PrinterHost/PrinterHost.c @@ -37,7 +37,7 @@ #include "PrinterHost.h" /** Main program entry point. This routine configures the hardware required by the application, then - * starts the scheduler to run the application tasks. + * enters a loop to run the application tasks in sequence. */ int main(void) { @@ -174,11 +174,11 @@ void USB_Printer_Host(void) { USB_ControlRequest = (USB_Request_Header_t) { - bmRequestType: (REQDIR_HOSTTODEVICE | REQTYPE_STANDARD | REQREC_INTERFACE), - bRequest: REQ_SetInterface, - wValue: PrinterAltSetting, - wIndex: PrinterInterfaceNumber, - wLength: 0, + .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) @@ -197,10 +197,10 @@ void USB_Printer_Host(void) puts_P(PSTR("Retrieving Device ID...\r\n")); - char DeviceIDString[256]; + char DeviceIDString[300]; if ((ErrorCode = Printer_GetDeviceID(DeviceIDString, sizeof(DeviceIDString))) != HOST_SENDCONTROL_Successful) { - printf_P(PSTR(ESC_FG_RED "Control Error (Get DeviceID).\r\n" + printf_P(PSTR(ESC_FG_RED "Control Error (Get Device ID).\r\n" " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode); /* Indicate error via status LEDs */ @@ -221,15 +221,12 @@ void USB_Printer_Host(void) /* Indicate device busy via the status LEDs */ LEDs_SetAllLEDs(LEDMASK_USB_BUSY); - Printer_Data_t TestPageData = - { - "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X", - (sizeof(TestPageData.Data) - 1) - }; + char TestPageData[] = "\033%-12345X\033E" "LUFA PCL Test Page" "\033E\033%-12345X"; + uint16_t TestPageLength = strlen(TestPageData); - printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageData.Length); + printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageLength); - if ((ErrorCode = Printer_SendData(&TestPageData)) != PIPE_RWSTREAM_NoError) + if ((ErrorCode = Printer_SendData(&TestPageData, TestPageLength)) != PIPE_RWSTREAM_NoError) { printf_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n" " -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);