canonselphy: Independently report on incorrect paper/ribbon errors for

the CP_XXX family.

Also make the errors more consistent with their language.
This commit is contained in:
Solomon Peachy 2014-01-30 20:00:21 -05:00
parent 4094e9d635
commit 64938b839e
1 changed files with 25 additions and 15 deletions

View File

@ -81,7 +81,7 @@ static int es2_error_detect(uint8_t *rdbuf)
{
if (rdbuf[0] == 0x16 &&
rdbuf[1] == 0x01) {
ERROR("Cover open!\n");
ERROR("Printer cover open!\n");
return 1;
}
@ -107,7 +107,7 @@ static int es3_error_detect(uint8_t *rdbuf)
if (rdbuf[10] == 0x0f) {
ERROR("Communications Error\n");
} else if (rdbuf[10] == 0x01) {
ERROR("No media/ribbon loaded!\n");
ERROR("No media loaded!\n");
} else {
ERROR("Unknown error - %02x + %02x\n",
rdbuf[8], rdbuf[10]);
@ -115,15 +115,15 @@ static int es3_error_detect(uint8_t *rdbuf)
return 1;
} else if (rdbuf[8] == 0x03 &&
rdbuf[10] == 0x02) {
ERROR("No media!\n");
ERROR("No media loaded!\n");
return 1;
} else if (rdbuf[8] == 0x08 &&
rdbuf[10] == 0x04) {
ERROR("Cover open!\n");
ERROR("Printer cover open!\n");
return 1;
} else if (rdbuf[8] == 0x05 &&
rdbuf[10] == 0x01) {
ERROR("Incorrect media!\n");
ERROR("Incorrect media loaded!\n");
return 1;
}
@ -154,13 +154,13 @@ static int es40_error_detect(uint8_t *rdbuf)
/* CP790 */
if (rdbuf[4] == 0x10 && rdbuf[5] == 0xff) {
ERROR("No ribbon!\n");
ERROR("No ribbon loaded!\n");
return 1;
} else if (rdbuf[4] == 0xff && rdbuf[5] == 0x01) {
ERROR("No media loaded!\n");
ERROR("No paper loaded!\n");
return 1;
} else if (rdbuf[2] == 0x01 && rdbuf[3] == 0x11) {
ERROR("Media feed error!\n");
ERROR("Paper feed error!\n");
return 1;
}
@ -173,9 +173,9 @@ static int cp10_error_detect(uint8_t *rdbuf)
return 0;
if (rdbuf[2] == 0x80)
ERROR("No ribbon\n");
ERROR("No ribbon loaded\n");
else if (rdbuf[2] == 0x01)
ERROR("No media!\n");
ERROR("No paper loaded!\n");
else
ERROR("Unknown error - %02x\n", rdbuf[2]);
return 1;
@ -187,7 +187,7 @@ static int cpxxx_error_detect(uint8_t *rdbuf)
return 0;
if (rdbuf[2] == 0x01)
ERROR("Out of paper!\n");
ERROR("Paper feed problem!\n");
else if (rdbuf[2] == 0x04)
ERROR("Ribbon problem!\n");
else if (rdbuf[2] == 0x08)
@ -677,10 +677,20 @@ top:
/* Make sure paper is correct */
if (ctx->paper_code != -1) {
if (ctx->printer->type == P_ES40_CP790) {
if (ctx->printer->type == P_CP_XXX) {
uint8_t pc = rdbuf[ctx->printer->paper_code_offset];
if (((pc >> 4) & 0xf) != (ctx->paper_code & 0x0f)) {
ERROR("Incorrect paper tray loaded, aborting job!\n");
return 3;
}
if ((pc & 0xf) != (ctx->paper_code & 0xf)) {
ERROR("Incorrect ribbon loaded, aborting job!\n");
return 3;
}
} else if (ctx->printer->type == P_ES40_CP790) {
if ((rdbuf[ctx->printer->paper_code_offset] & 0x0f) !=
(ctx->paper_code & 0x0f)) {
ERROR("Incorrect paper loaded (%02x vs %02x), aborting job!\n",
ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n",
ctx->paper_code,
rdbuf[ctx->printer->paper_code_offset]);
return 3; /* Hold this job, don't stop queue */
@ -688,7 +698,7 @@ top:
} else {
if (rdbuf[ctx->printer->paper_code_offset] !=
ctx->paper_code) {
ERROR("Incorrect paper loaded (%02x vs %02x), aborting job!\n",
ERROR("Incorrect media/ribbon loaded (%02x vs %02x), aborting job!\n",
ctx->paper_code,
rdbuf[ctx->printer->paper_code_offset]);
return 3; /* Hold this job, don't stop queue */
@ -823,7 +833,7 @@ top:
struct dyesub_backend canonselphy_backend = {
.name = "Canon SELPHY CP/ES",
.version = "0.72",
.version = "0.73",
.multipage_capable = 1,
.uri_prefix = "canonselphy",
.init = canonselphy_init,