kodak1400: Add error message parsing. Purely informative.

This commit is contained in:
Solomon Peachy 2021-07-06 19:37:42 -04:00
parent d08feb06e8
commit f7970ea003
5 changed files with 25 additions and 6 deletions

View File

@ -80,6 +80,24 @@ struct kodak1400_ctx {
struct marker marker;
};
static const char *kodak1400_errormsgs(uint8_t code1, uint8_t code2)
{
if (code1 == 0x00 && code2 == 0x08)
return "No paper tray";
else if (code1 == 0x02 && code2 == 0x00)
return "Paper jam";
else if (code1 == 0x02 && code2 == 0x01)
return "Cover open during printing";
else if (code1 == 0x08 && code2 == 0x00)
return "Top cover open";
else if (code1 == 0x10) // code2 == 0x00 and 0x01
return "Media mismatch";
else if (code1 == 0x40 && code2 == 0x00)
return "Paper empty";
else
return "Unknown";
}
static int send_plane(struct kodak1400_ctx *ctx,
const struct kodak1400_printjob *job,
uint8_t planeno, uint8_t *planedata,
@ -443,9 +461,10 @@ top:
/* Error handling */
if (rdbuf[4] || rdbuf[5]) {
ERROR("Error code reported by printer (%02x/%02x), terminating print\n",
ERROR("Error code reported: %s (%02x/%02x), terminating print\n",
kodak1400_errormsgs(rdbuf[4], rdbuf[5]),
rdbuf[4], rdbuf[5]);
return CUPS_BACKEND_STOP; // HOLD/CANCEL/FAILED? XXXX parse error!
return CUPS_BACKEND_STOP; // HOLD/CANCEL/FAILED?
}
fflush(logger);
@ -617,7 +636,7 @@ static const char *kodak1400_prefixes[] = {
const struct dyesub_backend kodak1400_backend = {
.name = "Kodak 1400/805",
.version = "0.42",
.version = "0.43",
.uri_prefixes = kodak1400_prefixes,
.cmdline_usage = kodak1400_cmdline,
.cmdline_arg = kodak1400_cmdline_arg,

View File

@ -1822,7 +1822,6 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob)
job->datalen += 3*job->planelen;
/* Clean up */
// XXX not really necessary.
free(job->spoolbuf);
job->spoolbuf = NULL;
job->spoolbuflen = 0;

View File

@ -1937,6 +1937,7 @@ const struct dyesub_backend mitsud90_backend = {
* cut limit?
* Validate Fujifilm ASK500 support
* Confirm ASK500 spool format
* Validate Panorama mode
*/

View File

@ -930,7 +930,7 @@ static int shinkos2145_main_loop(void *vctx, const void *vjob) {
int i, last_state = -1, state = S_IDLE;
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob;
const struct sinfonia_printjob *job = vjob;
struct sinfonia_cmd_hdr cmd;
struct s2145_status_resp sts, sts2;

View File

@ -1502,7 +1502,7 @@ static int shinkos6145_main_loop(void *vctx, const void *vjob) {
uint32_t cur_mode;
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob; /* XXX stupid, we can't do this. */
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob;
if (!job)
return CUPS_BACKEND_FAILED;