Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Erik Strand
lufa
Commits
ecf7c18c
Commit
ecf7c18c
authored
Sep 02, 2009
by
Dean Camera
Browse files
Fixed error in PrinterHost preventing the full page data from being sent to the attached device.
parent
0fdc1a2b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.c
View file @
ecf7c18c
...
...
@@ -39,18 +39,19 @@
/** Sends the given data directly to the printer via the data endpoints, for the sending of print commands in printer
* languages accepted by the attached printer (e.g. PCL).
*
* \param[in] PrinterCommands Pointer to a structure containing the commands and length of the data to send
* \param[in] PrinterCommands Pointer to the data to send to the attached printer
* \param[in] CommandSize Size of the data to send to the attached printer
*
* \return A value from the Pipe_Stream_RW_ErrorCodes_t enum
*/
uint8_t
Printer_SendData
(
Printer
_Data_t
*
Printer
Command
s
)
uint8_t
Printer_SendData
(
void
*
Printer
Commands
,
uint16_t
Command
Size
)
{
uint8_t
ErrorCode
;
Pipe_SelectPipe
(
PRINTER_DATA_OUT_PIPE
);
Pipe_Unfreeze
();
if
((
ErrorCode
=
Pipe_Write_Stream_LE
(
PrinterCommands
->
Data
,
PrinterCommands
->
Length
))
!=
PIPE_RWSTREAM_NoError
)
if
((
ErrorCode
=
Pipe_Write_Stream_LE
(
PrinterCommands
,
CommandSize
))
!=
PIPE_RWSTREAM_NoError
)
return
ErrorCode
;
Pipe_ClearOUT
();
...
...
Demos/Host/LowLevel/PrinterHost/Lib/PrinterCommands.h
View file @
ecf7c18c
...
...
@@ -58,18 +58,8 @@
/** Pipe number of the Printer data OUT pipe */
#define PRINTER_DATA_OUT_PIPE 2
/* Type Defines: */
/** Type define for a Printer Command Data structure, for the encapsulation of raw printer commands to
* send to an attached printer device.
*/
typedef
struct
{
char
*
Data
;
/**< Printer commands to send to the attached printer */
uint16_t
Length
;
/**< Length in bytes of the commands to send to the attached printer */
}
Printer_Data_t
;
/* Function Prototypes: */
uint8_t
Printer_SendData
(
Printer
_Data_t
*
Printer
Command
s
);
uint8_t
Printer_SendData
(
void
*
Printer
Commands
,
uint16_t
Command
Size
);
uint8_t
Printer_GetDeviceID
(
char
*
DeviceIDString
,
uint16_t
BufferSize
);
uint8_t
Printer_GetPortStatus
(
uint8_t
*
PortStatus
);
uint8_t
Printer_SoftReset
(
void
);
...
...
Demos/Host/LowLevel/PrinterHost/PrinterHost.c
View file @
ecf7c18c
...
...
@@ -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
\033
E"
"LUFA PCL Test Page"
"
\033
E
\033
%-12345X"
,
(
sizeof
(
TestPageData
.
Data
)
-
1
)
};
char
TestPageData
[]
=
"
\033
%-12345X
\033
E"
"LUFA PCL Test Page"
"
\033
E
\033
%-12345X"
;
uint16_t
TestPageLength
=
strlen
(
TestPageData
);
printf_P
(
PSTR
(
"Sending Test Page (%d bytes)...
\r\n
"
),
TestPage
Data
.
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
);
...
...
LUFA/ManPages/ChangeLog.txt
View file @
ecf7c18c
...
...
@@ -49,6 +49,7 @@
* - Fixed Device mode HID Class driver not explicitly initializing the ReportSize parameter to zero before calling callback
* routine, so that ignored callbacks don't cause incorrect data to be sent
* - Fixed StillImageHost not correctly freezing and unfreezing data pipes while waiting for a response block header
* - Fixed error in PrinterHost preventing the full page data from being sent to the attached device
*
*
* \section Sec_ChangeLog090810 Version 090810
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment