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.

This commit is contained in:
Dean Camera 2009-07-20 02:59:16 +00:00
parent 8a68203d34
commit 5d8cdd9bea
4 changed files with 6 additions and 6 deletions

View file

@ -37,14 +37,14 @@
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
uint8_t Printer_SendData(char* PrinterCommands)
uint8_t Printer_SendData(char* PrinterCommands, uint16_t DataLength)
{
uint8_t ErrorCode;
Pipe_SelectPipe(PRINTER_DATA_OUT_PIPE);
Pipe_Unfreeze();
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, strlen(PrinterCommands))) != PIPE_RWSTREAM_NoError)
if ((ErrorCode = Pipe_Write_Stream_LE(PrinterCommands, DataLength)) != PIPE_RWSTREAM_NoError)
return ErrorCode;
Pipe_ClearOUT();