aboutsummaryrefslogtreecommitdiffstats
path: root/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2009-07-20 03:07:27 +0000
committerDean Camera <dean@fourwalledcubicle.com>2009-07-20 03:07:27 +0000
commit4c035b14f1349828384946523987f009c9966690 (patch)
treefbda7f2fa935af2bd51252875407da68bc429446 /Demos/Host/Incomplete/PrinterHost/PrinterHost.c
parent5d8cdd9bea07acd276b260b34bea299a45a9088a (diff)
downloadlufa-4c035b14f1349828384946523987f009c9966690.tar.gz
lufa-4c035b14f1349828384946523987f009c9966690.tar.bz2
lufa-4c035b14f1349828384946523987f009c9966690.zip
Cleaner solution to the PrinterHost data send routine problem of embedded NULLs - use a special structure to hold the data string plus the length in bytes of the data.
Diffstat (limited to 'Demos/Host/Incomplete/PrinterHost/PrinterHost.c')
-rw-r--r--Demos/Host/Incomplete/PrinterHost/PrinterHost.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/Demos/Host/Incomplete/PrinterHost/PrinterHost.c b/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
index bff5e2020..9eb05abd8 100644
--- a/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
+++ b/Demos/Host/Incomplete/PrinterHost/PrinterHost.c
@@ -204,12 +204,16 @@ void USB_Printer_Host(void)
/* Indicate device busy via the status LEDs */
LEDs_SetAllLEDs(LEDMASK_USB_BUSY);
- char PCL_Test_Page[] = "\033%-12345X\033E LUFA PCL Test Page \033E\033%-12345X";
-// char ESCP2_Test_Page[] = "\033@\033i\001\033X\001\060\000\r\nLUFA ESCP/2 Test Page\r\n";
-
- printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), (sizeof(PCL_Test_Page) - 1));
+ Printer_Data_t TestPageData =
+ {
+ "\033%-12345X\033E LUFA PCL Test Page \033E\033%-12345X",
+// "\033@\033i\001\033X\001\060\000\r\nLUFA ESCP/2 Test Page\r\n",
+ (sizeof(TestPageData.Data) - 1)
+ };
+
+ printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), TestPageData.Length);
- if ((ErrorCode = Printer_SendData(PCL_Test_Page, (sizeof(PCL_Test_Page) - 1))) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = Printer_SendData(&TestPageData)) != PIPE_RWSTREAM_NoError)
{
puts_P(PSTR(ESC_FG_RED "Error Sending Test Page.\r\n"));
printf_P(PSTR(" -- Error Code: %d\r\n" ESC_FG_WHITE), ErrorCode);