hiti: Properly check the job status flag.
An unknown flag is ocming up that's signifying an error state.
This commit is contained in:
parent
216560c1b2
commit
1e908e0422
|
@ -205,6 +205,7 @@ struct hiti_job_qqa {
|
|||
#define QQA_STATUS_PRINTING 0x00
|
||||
#define QQA_STATUS_WAITING 0x01
|
||||
#define QQA_STATUS_SUSPENDED 0x03
|
||||
#define QQA_STATUS_ERROR 0x80 // ???
|
||||
|
||||
/* CMD_JC_QJC */
|
||||
struct hiti_jc_qjc {
|
||||
|
@ -651,6 +652,7 @@ static const char *hiti_jobstatuses(uint8_t code)
|
|||
case QQA_STATUS_PRINTING: return "Printing";
|
||||
case QQA_STATUS_WAITING: return "Waiting";
|
||||
case QQA_STATUS_SUSPENDED: return "Suspended";
|
||||
case QQA_STATUS_ERROR: return "Unknown Error";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
@ -953,7 +955,7 @@ static int hiti_get_status(struct hiti_ctx *ctx)
|
|||
struct hiti_job job = { 0 };
|
||||
hiti_query_job_qa(ctx, &job, &qqa);
|
||||
for (i = 0 ; i < qqa.count ; i++) {
|
||||
INFO("JobID %02x %04x (%s)\n",
|
||||
INFO("JobID %02x %04x (status %s)\n",
|
||||
qqa.row[i].job.lun,
|
||||
be16_to_cpu(qqa.row[i].job.jobid),
|
||||
hiti_jobstatuses(qqa.row[i].status));
|
||||
|
@ -2102,7 +2104,7 @@ static int hiti_main_loop(void *vctx, const void *vjob, int wait_for_return)
|
|||
|
||||
// XXX msg 8011 sent here on P52x (and maybe others?)
|
||||
|
||||
/* XXX startjob returns actual jobid */
|
||||
/* Initialize jobid structure */
|
||||
jobid.lun = 0;
|
||||
jobid.jobid = cpu_to_be16(ctx->jobid);
|
||||
|
||||
|
@ -2257,6 +2259,14 @@ resend_c:
|
|||
if (qqa.count == 0 || qqa.row[0].job.jobid == 0)
|
||||
break;
|
||||
|
||||
for (int i = 0 ; i < qqa.count ; i++) {
|
||||
if (qqa.row[i].job.jobid == jobid.jobid) {
|
||||
if (qqa.row[i].status > QQA_STATUS_SUSPENDED) {
|
||||
ERROR("Printer reported abnormal job status %02x\n", qqa.row[i].status);
|
||||
return CUPS_BACKEND_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while(1);
|
||||
|
||||
INFO("Print complete\n");
|
||||
|
@ -2710,7 +2720,7 @@ static const char *hiti_prefixes[] = {
|
|||
|
||||
const struct dyesub_backend hiti_backend = {
|
||||
.name = "HiTi Photo Printers",
|
||||
.version = "0.42",
|
||||
.version = "0.43",
|
||||
.uri_prefixes = hiti_prefixes,
|
||||
.cmdline_usage = hiti_cmdline,
|
||||
.cmdline_arg = hiti_cmdline_arg,
|
||||
|
|
Loading…
Reference in a new issue