[all] Add support for an error readback. CP-series, ES2/20 handled.

This commit is contained in:
Solomon Peachy 2012-11-19 21:45:49 -05:00
parent c3765df0b3
commit 50b9111237
4 changed files with 21 additions and 2 deletions

View file

@ -50,7 +50,7 @@
cp selphy_print_libusb /usr/lib/cups/backend/selphy
chown root:root /usr/lib/cups/backend/selphy
chmod 500 /usr/lib/cups/backend/selphy
chmod 700 /usr/lib/cups/backend/selphy
You may need to restart CUPS, and you will also need a prerelease
version of gutenprint installed.

View file

@ -25,7 +25,7 @@
*
*/
#define VERSION "0.30"
#define VERSION "0.32"
#define DEBUG( ... ) fprintf(stderr, "DEBUG: " __VA_ARGS__ )
#define ERROR( ... ) fprintf(stderr, "ERROR: " __VA_ARGS__ )
@ -56,6 +56,7 @@ struct printer_data {
int16_t ready_m_readback[READBACK_LEN];
int16_t ready_c_readback[READBACK_LEN];
int16_t done_c_readback[READBACK_LEN];
int16_t error_readback[READBACK_LEN];
int16_t paper_codes[256];
int16_t pgcode_offset; /* Offset into printjob for paper type */
int16_t paper_code_offset; /* Offset in readback for paper type */
@ -82,6 +83,7 @@ struct printer_data printers[P_END] = {
.ready_m_readback = { 0x04, 0x00, 0x03, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x04, 0x00, 0x07, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x04, 0x00, 0x00, 0x00, 0x02, 0x01, -1, 0x01, 0x00, 0x00, 0x00, 0x00 },
// .error_readback
// .paper_codes
.pgcode_offset = 3,
.paper_code_offset = 6,
@ -95,6 +97,7 @@ struct printer_data printers[P_END] = {
.ready_m_readback = { 0x06, 0x00, 0x03, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x09, 0x00, 0x07, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x09, 0x00, 0x00, 0x00, -1, 0x00, -1, -1, 0x00, 0x00, 0x00, 0x00 },
.error_readback = { 0x14, 0x00, -1, 0x00, -1, 0x00, -1, 0x00, -1, 0x00, 0x00, 0x00 },
// .paper_codes
.pgcode_offset = 2,
.paper_code_offset = 4,
@ -108,6 +111,7 @@ struct printer_data printers[P_END] = {
.ready_m_readback = { 0x03, 0xff, 0x02, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.ready_c_readback = { 0x05, 0xff, 0x03, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
.done_c_readback = { 0x00, 0xff, 0x10, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00 },
// .error_readback
// .paper_codes
.pgcode_offset = -1,
.paper_code_offset = -1,
@ -121,6 +125,7 @@ struct printer_data printers[P_END] = {
// .ready_m_readback =
// .ready_c_readback =
// .done_c_readback =
// .error_readback
// .paper_codes
.pgcode_offset = 2,
// .paper_code_offset = -1,
@ -134,6 +139,7 @@ struct printer_data printers[P_END] = {
.ready_m_readback = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.ready_c_readback = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.done_c_readback = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.error_readback = { 0x02, 0x00, 0x08, 0x00, 0x70, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
// .paper_codes
.pgcode_offset = 3,
.paper_code_offset = 6,
@ -147,6 +153,8 @@ struct printer_data printers[P_END] = {
.ready_m_readback = { 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.ready_c_readback = { 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.done_c_readback = { 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
.error_readback = { 0x02, 0x00, 0x08, 0x00, 0x70, 0x00, -1, 0x00, 0x00, 0x00, 0x00, -1 },
// .error_readback
// .paper_codes
.pgcode_offset = 3,
.paper_code_offset = 6,

View file

@ -428,6 +428,12 @@ top:
}
fflush(stderr);
if (!memcmp(rdbuf, printers[printer_type].error_readback, READBACK_LEN)) {
DEBUG("error condition; aborting. (Out of ribbon/paper?)\n");
ret = 4;
goto done_claimed;
}
switch(state) {
case S_IDLE:
if (!fancy_memcmp(rdbuf, printers[printer_type].init_readback, READBACK_LEN, paper_code_offset, paper_code)) {

View file

@ -172,6 +172,11 @@ top:
}
fflush(stderr);
if (!memcmp(rdbuf, printers[printer_type].error_readback, READBACK_LEN)) {
DEBUG("error condition; aborting. (Out of ribbon/paper?)\n");
return 4;
}
switch(state) {
case S_IDLE:
if (!fancy_memcmp(rdbuf, printers[printer_type].init_readback, READBACK_LEN, paper_code_offset, paper_code)) {