diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-20 02:59:16 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2009-07-20 02:59:16 +0000 |
commit | 5d8cdd9bea07acd276b260b34bea299a45a9088a (patch) | |
tree | 5a6d883cd12ea59d4e36f54654d7b96d3b99930d /Demos/Host/Incomplete/PrinterHost/PrinterHost.c | |
parent | 8a68203d3451c50c573c6baf4850e72d8dbabfcb (diff) | |
download | lufa-5d8cdd9bea07acd276b260b34bea299a45a9088a.tar.gz lufa-5d8cdd9bea07acd276b260b34bea299a45a9088a.tar.bz2 lufa-5d8cdd9bea07acd276b260b34bea299a45a9088a.zip |
Fix unfinished printer host demo - some printer languages use embedded NULLs and so strlen() won't work in all cases. Ensure NULL terminator for the test page is not transmitted to the device.
Diffstat (limited to 'Demos/Host/Incomplete/PrinterHost/PrinterHost.c')
-rw-r--r-- | Demos/Host/Incomplete/PrinterHost/PrinterHost.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Demos/Host/Incomplete/PrinterHost/PrinterHost.c b/Demos/Host/Incomplete/PrinterHost/PrinterHost.c index 220046574..bff5e2020 100644 --- a/Demos/Host/Incomplete/PrinterHost/PrinterHost.c +++ b/Demos/Host/Incomplete/PrinterHost/PrinterHost.c @@ -207,9 +207,9 @@ void USB_Printer_Host(void) 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"), strlen(PCL_Test_Page));
+ printf_P(PSTR("Sending Test Page (%d bytes)...\r\n"), (sizeof(PCL_Test_Page) - 1));
- if ((ErrorCode = Printer_SendData(PCL_Test_Page)) != PIPE_RWSTREAM_NoError)
+ if ((ErrorCode = Printer_SendData(PCL_Test_Page, (sizeof(PCL_Test_Page) - 1))) != 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);
|