diff options
author | Didier Raboud <odyx@debian.org> | 2019-09-13 17:56:14 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2019-09-13 17:56:14 +0200 |
commit | b38516f13a1f563aa1eb7faf80965755ac63e3e6 (patch) | |
tree | fd60cd4095a45f7327d28dfe04bbfb34b7d7215a /src/cups/backend_mitsu70x.c | |
parent | e50542121e724e851fc5d6c68bb773f80c0bc12c (diff) |
New upstream version 5.3.3
Diffstat (limited to 'src/cups/backend_mitsu70x.c')
-rw-r--r-- | src/cups/backend_mitsu70x.c | 95 |
1 files changed, 69 insertions, 26 deletions
diff --git a/src/cups/backend_mitsu70x.c b/src/cups/backend_mitsu70x.c index 154fabb..687caac 100644 --- a/src/cups/backend_mitsu70x.c +++ b/src/cups/backend_mitsu70x.c @@ -324,8 +324,8 @@ struct mitsu70x_status_deck { uint8_t media_brand; uint8_t media_type; uint8_t rsvd_b[2]; - uint16_t capacity; /* media capacity */ - uint16_t remain; /* media remaining */ + int16_t capacity; /* media capacity */ + int16_t remain; /* media remaining */ uint8_t rsvd_c[2]; uint8_t lifetime_prints[4]; /* lifetime prints on deck + 10, in BCD! */ uint8_t rsvd_d[2]; // Unknown @@ -805,6 +805,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ resp.upper.media_type = media_code; resp.lower.media_type = media_code; resp.dual_deck = 0x80; /* Make it a dual deck */ + resp.vers[0].ver[0] = 0; } /* Figure out if we're a D707 with two decks */ @@ -833,10 +834,11 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ if (ctx->type == P_KODAK_305) { /* Known versions: v1.02: M 316E81 1433 (Add Ultrafine and matte support) - v1.04: M 316F83 2878 (Add 2x6 strip and support "Triton" media) + v1.04: M 316F83 2878 (Add 2x6 strip and support new "Triton" media) + v3.01: M 443A12 8908 (add 5" media support) */ - if (strncmp(resp.vers[0].ver, "316F83", 6) < 0) - WARNING("Printer FW out of date. Highly recommend upgrading EK305 to v1.04 or newer!\n"); + if (strncmp(resp.vers[0].ver, "443A12", 6) < 0) + WARNING("Printer FW out of date. Highly recommend upgrading EK305 to v3.01 or newer!\n"); } else if (ctx->type == P_MITSU_K60) { /* Known versions: v1.05: M 316M31 148C (Add HG media support) @@ -1295,7 +1297,7 @@ repeat: } if (job->lutfname && ctx->lut) { - DEBUG("Running print data through LUT\n"); + DEBUG("Running print data through 3D LUT\n"); ctx->DoColorConv(ctx->lut, job->spoolbuf, job->cols, job->rows, job->cols * 3, COLORCONV_BGR); } @@ -1721,7 +1723,7 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob) int ret; int copies; - int deck; + int deck, legal, reqdeck; struct mitsu70x_printjob *job = (struct mitsu70x_printjob *) vjob; // XXX not clean. // const struct mitsu70x_printjob *job = vjob; @@ -1734,6 +1736,9 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob) copies = job->copies; hdr = (struct mitsu70x_hdr*) job->databuf; + /* Keep track of deck requested */ + reqdeck = hdr->deck; + if (job->raw_format) goto bypass; @@ -1865,7 +1870,7 @@ top: /* First, try to respect requested deck */ if (ctx->type == P_MITSU_D70X) { - deck = hdr->deck; /* Respect D70 deck choice, 0 is automatic. */ + deck = reqdeck; /* Respect D70 deck choice, 0 is automatic. */ } else { deck = 1; /* All others have one deck only */ } @@ -1901,6 +1906,7 @@ top: job->decks_ok[0], job->decks_ok[1]); /* Okay, we know which decks are _legal_, pick one to use */ + legal = deck; if (deck & 1) { if (jobstatus.temperature == TEMPERATURE_COOLING) { if (ctx->num_decks == 2) @@ -1909,7 +1915,8 @@ top: INFO("Printer cooling down...\n"); deck &= ~1; } else if (jobstatus.error_status[0]) { - ERROR("%s/%s -> %s: %02x/%02x/%02x\n", + ERROR("%s %s/%s -> %s: %02x/%02x/%02x\n", + ctx->num_decks == 2 ? "LOWER:": "", mitsu70x_errorclass(jobstatus.error_status), mitsu70x_errors(jobstatus.error_status), mitsu70x_errorrecovery(jobstatus.error_status), @@ -1917,8 +1924,9 @@ top: jobstatus.error_status[1], jobstatus.error_status[2]); deck &= ~1; + legal &= ~1; /* Deck is offline! */ } else if (jobstatus.mecha_status[0] != MECHA_STATUS_IDLE) { - deck = ~1; + deck &= ~1; } } if (deck & 2) { @@ -1934,8 +1942,9 @@ top: jobstatus.error_status_up[1], jobstatus.error_status_up[2]); deck &= ~2; + legal &= ~2; /* Deck is offline! */ } else if (jobstatus.mecha_status_up[0] != MECHA_STATUS_IDLE) { - deck = ~2; + deck &= ~2; } } @@ -1950,18 +1959,28 @@ top: if (ctx->num_decks > 1) DEBUG("Deck selected: %d\n", deck); + /* Great, we have no decks we can currently print this job on.. */ if (deck == 0) { /* Halt queue if printer is entirely offline */ if (ctx->num_decks == 2) { - if (jobstatus.error_status[0] && jobstatus.error_status_up[0]) + if (jobstatus.error_status[0] && jobstatus.error_status_up[0]) { + ERROR("Both decks offline due to errors\n"); return CUPS_BACKEND_STOP; - // XXX what if we only have one legal deck, and it's unavailable? We don't want to retry indefinitely here.. + } } else { - if (jobstatus.error_status[0]) + if (jobstatus.error_status[0]) { + ERROR("Printer offline due to errors\n"); return CUPS_BACKEND_STOP; + } } - /* No decks available yet, retry */ + /* Hold job if we have no legal decks for it, but printer is online. */ + if (!legal) { + ERROR("Legal deck for printjob has errors, aborting job"); + return CUPS_BACKEND_HOLD; + } + + /* Legal decks are busy, retry */ sleep(1); goto top; } @@ -2085,7 +2104,7 @@ top: return CUPS_BACKEND_FAILED; /* See if we hit a printer error. */ - if (deck == 0) { + if (deck == 1) { if (jobstatus.error_status[0]) { ERROR("%s/%s -> %s: %02x/%02x/%02x\n", mitsu70x_errorclass(jobstatus.error_status), @@ -2094,9 +2113,14 @@ top: jobstatus.error_status[0], jobstatus.error_status[1], jobstatus.error_status[2]); + + /* Retry job on the other deck.. */ + if (ctx->num_decks == 2) + goto top; + return CUPS_BACKEND_STOP; } - } else if (deck == 1) { + } else if (deck == 2) { if (jobstatus.error_status_up[0]) { ERROR("UPPER: %s/%s -> %s: %02x/%02x/%02x\n", mitsu70x_errorclass(jobstatus.error_status_up), @@ -2105,6 +2129,11 @@ top: jobstatus.error_status_up[0], jobstatus.error_status_up[1], jobstatus.error_status_up[2]); + + /* Retry job on the other deck.. */ + if (ctx->num_decks == 2) + goto top; + return CUPS_BACKEND_STOP; } } @@ -2136,16 +2165,20 @@ top: break; } + /* See if we can return early, but wait until printing has started! */ + if (fast_return && copies <= 1 && /* Copies generated by backend! */ + jobstatus.job_status[0] == JOB_STATUS0_PRINT && + jobstatus.job_status[1] > JOB_STATUS1_PRINT_MEDIALOAD) + { + INFO("Fast return mode enabled.\n"); + break; + } + /* On a two deck system, try to use the second deck for additional copies. If we can't use it, we'll block. */ if (ctx->num_decks > 1 && copies > 1) break; - if (fast_return && copies <= 1) { /* Copies generated by backend! */ - INFO("Fast return mode enabled.\n"); - break; - } - /* Update cache for the next round */ memcpy(last_status, jobstatus.job_status, 4); } while(1); @@ -2167,6 +2200,7 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx, struct mitsu70x_printerstatus_resp *resp) { uint32_t i; + uint8_t memory = ~resp->memory; INFO("Model : "); for (i = 0 ; i < 6 ; i++) { @@ -2198,6 +2232,15 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx, INFO("Standby Timeout: %d minutes\n", resp->sleeptime); INFO("iSerial Reporting: %s\n", resp->iserial ? "No" : "Yes" ); INFO("Power Status: %s\n", resp->power ? "Sleeping" : "Awake"); + INFO("Available Memory Banks: %s%s%s%s%s%s%s%s\n", + (memory & 0x01) ? "mem8 " : "", + (memory & 0x02) ? "mem7 " : "", + (memory & 0x04) ? "mem6 " : "", + (memory & 0x08) ? "mem5 " : "", + (memory & 0x10) ? "mem4 " : "", + (memory & 0x20) ? "mem3 " : "", + (memory & 0x40) ? "mem2 " : "", + (memory & 0x80) ? "mem1 " : ""); if (resp->lower.error_status[0]) { INFO("Lower Error Status: %s/%s -> %s\n", @@ -2292,6 +2335,7 @@ static int mitsu70x_query_jobs(struct mitsu70x_ctx *ctx) } INFO("Temperature: %s\n", mitsu70x_temperatures(jobstatus.temperature)); } + // memory status? #if 0 @@ -2354,7 +2398,6 @@ static void mitsu70x_cmdline(void) DEBUG("\t\t[ -j ] # Query job status\n"); DEBUG("\t\t[ -w ] # Wake up printer\n"); DEBUG("\t\t[ -W ] # Wake up printer and wait\n"); - DEBUG("\t\t[ -f ] # Use fast return mode\n"); DEBUG("\t\t[ -k num ] # Set standby time (1-60 minutes, 0 disables)\n"); DEBUG("\t\t[ -x num ] # Set USB iSerialNumber Reporting (1 on, 0 off)\n"); DEBUG("\t\t[ -X jobid ] # Abort a printjob\n");} @@ -2437,7 +2480,7 @@ static int mitsu70x_query_markers(void *vctx, struct marker **markers, int *coun static const char *mitsu70x_prefixes[] = { "mitsu70x", // Family entry, do not nuke. - "mitsubishi-d70dw", "mitsubishi-d80dw", "mitsubishi-k60dw", "kodak-305", "fujifilm-ask-300" + "mitsubishi-d70dw", "mitsubishi-d80dw", "mitsubishi-k60dw", "kodak-305", "fujifilm-ask-300", // Extras "mitsubishi-d707dw", "mitsubishi-k60dws", // backwards compatibility @@ -2448,7 +2491,7 @@ static const char *mitsu70x_prefixes[] = { /* Exported */ struct dyesub_backend mitsu70x_backend = { .name = "Mitsubishi CP-D70 family", - .version = "0.88", + .version = "0.95", .uri_prefixes = mitsu70x_prefixes, .flags = BACKEND_FLAG_JOBLIST, .cmdline_usage = mitsu70x_cmdline, @@ -2471,7 +2514,7 @@ struct dyesub_backend mitsu70x_backend = { } }; -/* Mitsubish CP-D70DW/D707DW/K60DW-S/D80DW, Kodak 305, Fuji ASK-300 +/* Mitsubish CP-D70DW/D707DW/K60DW-S/D80DW, Kodak 305, Fujifilm ASK-300 data format: Spool file consists of two headers followed by three image planes |