From a9e702979f438cc85100bb894cfefeb65cd77821 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 10 Dec 2024 19:26:17 -0500 Subject: [PATCH] mitsud90: CP-D90DW-SL uses a variation of the PAGE START command (changed offset 0x05 from 0x33 to 0x03) --- backend_mitsud90.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/backend_mitsud90.c b/backend_mitsud90.c index b9a51d8..50be6e9 100644 --- a/backend_mitsud90.c +++ b/backend_mitsud90.c @@ -284,7 +284,7 @@ struct mitsud90_job_resp { } __attribute__((packed)); struct mitsud90_job_hdr { - uint8_t hdr[6]; /* 1b 53 50 30 00 33 */ + uint8_t hdr[6]; /* 1b 53 50 30 00 ?? -- 03 on D90SL, 33 on rest */ uint16_t cols; /* BE */ uint16_t rows; /* BE */ uint8_t waittime; /* 0-100 */ @@ -643,6 +643,7 @@ struct mitsud90_ctx { char fwver_main[7]; /* 6+null */ char fwver_mech[7]; /* 6+null */ + uint8_t hdr_model_code; /* Used in parsing.. */ struct mitsud90_job_footer holdover; int holdover_on; @@ -921,6 +922,7 @@ static int mitsud90_attach(void *vctx, struct dyesub_connection *conn, uint8_t j UNUSED(jobid); ctx->conn = conn; + ctx->hdr_model_code = 0x33; if (test_mode < TEST_MODE_NOATTACH) { if (mitsud90_query_media(ctx, &ctx->media)) @@ -934,6 +936,10 @@ static int mitsud90_attach(void *vctx, struct dyesub_connection *conn, uint8_t j } if (mitsud90_query_fwver(ctx)) return CUPS_BACKEND_FAILED; + if (ctx->conn->type == P_MITSU_D90 && + ctx->conn->usb_pid == 0x3b62) { + ctx->hdr_model_code = 0x03; + } } else { ctx->media.media.brand = 0xff; ctx->media.media.type = 0x0f; @@ -980,8 +986,9 @@ static int mitsud90_attach(void *vctx, struct dyesub_connection *conn, uint8_t j } else if (ctx->conn->type == P_MITSU_D90) { // XXX figure out if printer can handle panorama! (FW "2.10" is needed) // - // CP-D90DW v2.10 is 415A81/415G11 (revA/B) ME is 419E11 - // CP-D90DW-P v2.10 is 415B94/415E54 (revA/B) ME is 419E42 + // CP-D90DW v2.10 is 415A81/415G11 (revA/B) ME is 419E11 + // CP-D90DW-P v2.10 is 415B94/415E54 (revA/B) ME is 419E42 + // CP-D90DW-SL v3.10 is 415D71 ME is 419D61 // D90DW-P and D90DW share same USB VID/PID. Unclear if any functional or runtime difference. } else if (ctx->conn->type == P_FUJI_ASK500) { // Completely unknown. @@ -1172,6 +1179,10 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c return CUPS_BACKEND_CANCEL; } + /* Override model code as needed */ + if (job->hdr.hdr[5] != ctx->hdr_model_code) + job->hdr.hdr[5] = ctx->hdr_model_code; + /* Initial parsing */ if (ctx->conn->type == P_MITSU_M1 || ctx->conn->type == P_FUJI_ASK500) { @@ -2648,8 +2659,6 @@ static const struct device_id mitsud90_devices[] = { { 0x06d3, 0x3b80, P_MITSU_M1, NULL, "mitsubishi-cpm1"}, { 0x06d3, 0x3b80, P_MITSU_M1, NULL, "mitsubishi-cpm15"}, // Duplicate for the M15 { 0x06d3, 0x3b50, P_MITSU_W5000, NULL, "mitsubishi-cpw5000"}, - - // { 0x04cb, 0x1234, P_FUJI_ASK500, NULL, "fujifilm-ask500"}, { 0, 0, 0, NULL, NULL} }; @@ -2657,7 +2666,7 @@ static const struct device_id mitsud90_devices[] = { /* Exported */ const struct dyesub_backend mitsud90_backend = { .name = "Mitsubishi CP-D90/CP-M1/CP-W5000", - .version = "0.53" " (lib " LIBMITSU_VER ")", + .version = "0.54" " (lib " LIBMITSU_VER ")", .flags = BACKEND_FLAG_DUMMYPRINT, .uri_prefixes = mitsud90_prefixes, .devices = mitsud90_devices, @@ -2699,7 +2708,7 @@ const struct dyesub_backend mitsud90_backend = { [[ PAGE HEADER ]] - 1b 53 50 30 00 33 XX XX YY YY TT 00 00 01 MM NN XX XX == COLS, YY XX ROWS (BE) + 1b 53 50 30 00 GG XX XX YY YY TT 00 00 01 MM NN XX XX == COLS, YY XX ROWS (BE) ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 NN == num of cuts, ?? see below 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 MM == 0 for no margin cut, 1 for margin cut QQ RR SS HH VV 00 00 00 00 00 ZZ 00 JJ II 09 7c QQ == 02 matte (D90) or 03 (M1), 00 glossy, @@ -2711,6 +2720,7 @@ const struct dyesub_backend mitsud90_backend = { Z0 is 0x01 (M1 windows) (00 Linux and d90 UNK!) Z1 is RGB Rate (M1) Z2 is OP Rate (M1) + GG is 0x03 (D90SL) or 0x33 (rest) [pad to 512b] normal == rows 00 00 00 00 00 00 00 00 00