mitsu: Document some more CP-M1 stuff, and move a little common code.
This commit is contained in:
parent
196db2230d
commit
1b6d98a292
|
@ -198,3 +198,59 @@ int mitsu_readlamdata(const char *fname, uint16_t lamstride,
|
|||
|
||||
return CUPS_BACKEND_OK;
|
||||
}
|
||||
|
||||
const char *mitsu_temperatures(uint8_t temp)
|
||||
{
|
||||
switch(temp) {
|
||||
case TEMPERATURE_NORMAL:
|
||||
return "Normal";
|
||||
case TEMPERATURE_PREHEAT:
|
||||
return "Warming Up";
|
||||
case TEMPERATURE_COOLING:
|
||||
return "Cooling Down";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown Temperature Status";
|
||||
}
|
||||
|
||||
const char *mitsu_media_types(uint8_t brand, uint8_t type)
|
||||
{
|
||||
if (brand == 0xff && type == 0x01)
|
||||
return "CK-D735 (3.5x5)";
|
||||
else if (brand == 0xff && type == 0x02)
|
||||
return "CK-D746 (4x6)";
|
||||
else if (brand == 0xff && type == 0x04)
|
||||
return "CK-D757 (5x7)";
|
||||
else if (brand == 0xff && type == 0x05)
|
||||
return "CK-D769 (6x9)";
|
||||
else if (brand == 0xff && type == 0x0f)
|
||||
return "CK-D768/CK-D868 (6x8)";
|
||||
else if (brand == 0x6c && type == 0x84)
|
||||
return "Kodak 5R (5x7)";
|
||||
else if (brand == 0x6c && type == 0x8f)
|
||||
return "Kodak 6R (6x8)";
|
||||
else if (brand == 0x61 && type == 0x84)
|
||||
return "CK-K57R (5x7)";
|
||||
else if (brand == 0x61 && type == 0x8f)
|
||||
return "CK-K76R (6x8)";
|
||||
else if (brand == 0x7a && type == 0x01)
|
||||
return "RL-CF900 (3.5x5)";
|
||||
else if (brand == 0x7a && type == 0x02)
|
||||
return "RK-CF800/4R (4x6)";
|
||||
else if (brand == 0x7a && type == 0x04)
|
||||
return "R2L-CF460/5R (5x7)";
|
||||
else if (brand == 0x7a && type == 0x0f)
|
||||
return "R68-CF400/6R (6x8)";
|
||||
else
|
||||
return "Unknown";
|
||||
|
||||
// Also CK-D715, CK-D718, CK-D720, CK-D723 (4x6,5x8,6x8,6x9) for D70-S model
|
||||
// CK-D746-U for D70-U model
|
||||
// CK-D820 (6x8) for D80-S model
|
||||
// D90 can use _all_ of these types except for the -U!
|
||||
|
||||
// CK-M57S (5x7 for M1)
|
||||
// CK-M68S (6x8 for M1)
|
||||
// CK-M46S (6x4 for M1)
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef void (*CP98xx_DestroyDataFN)(const struct mitsu98xx_data *data);
|
|||
|
||||
#define REQUIRED_LIB_APIVERSION 5
|
||||
|
||||
#define LIBMITSU_VER "0.03"
|
||||
#define LIBMITSU_VER "0.04"
|
||||
|
||||
/* Image processing library function prototypes */
|
||||
#define LIB_NAME_RE "libMitsuD70ImageReProcess" DLL_SUFFIX
|
||||
|
@ -114,3 +114,10 @@ int mitsu_apply3dlut(struct mitsu_lib *lib, char *lutfname, uint8_t *databuf,
|
|||
int mitsu_readlamdata(const char *fname, uint16_t lamstride,
|
||||
uint8_t *databuf, uint32_t *datalen,
|
||||
uint16_t rows, uint16_t cols, uint8_t bpp);
|
||||
|
||||
#define TEMPERATURE_NORMAL 0x00
|
||||
#define TEMPERATURE_PREHEAT 0x40
|
||||
#define TEMPERATURE_COOLING 0x80
|
||||
|
||||
const char *mitsu_temperatures(uint8_t temp);
|
||||
const char *mitsu_media_types(uint8_t brand, uint8_t type);
|
||||
|
|
|
@ -134,10 +134,6 @@ struct mitsu70x_jobs {
|
|||
struct mitsu70x_job jobs[NUM_JOBS];
|
||||
} __attribute__((packed));
|
||||
|
||||
#define TEMPERATURE_NORMAL 0x00
|
||||
#define TEMPERATURE_PREHEAT 0x40
|
||||
#define TEMPERATURE_COOLING 0x80
|
||||
|
||||
#define MECHA_STATUS_INIT 0x80
|
||||
#define MECHA_STATUS_FEED 0x50
|
||||
#define MECHA_STATUS_LOAD 0x40
|
||||
|
@ -329,21 +325,6 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob);
|
|||
|
||||
/* Error dumps, etc */
|
||||
|
||||
const char *mitsu70x_temperatures(uint8_t temp)
|
||||
{
|
||||
switch(temp) {
|
||||
case TEMPERATURE_NORMAL:
|
||||
return "Normal";
|
||||
case TEMPERATURE_PREHEAT:
|
||||
return "Warming Up";
|
||||
case TEMPERATURE_COOLING:
|
||||
return "Cooling Down";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Unknown Temperature Status";
|
||||
}
|
||||
|
||||
static const char *mitsu70x_mechastatus(uint8_t *sts)
|
||||
{
|
||||
switch(sts[0]) {
|
||||
|
@ -579,43 +560,6 @@ static const char *mitsu70x_errors(uint8_t *err)
|
|||
return "Unknown error";
|
||||
}
|
||||
|
||||
const char *mitsu70x_media_types(uint8_t brand, uint8_t type)
|
||||
{
|
||||
if (brand == 0xff && type == 0x01)
|
||||
return "CK-D735 (3.5x5)";
|
||||
else if (brand == 0xff && type == 0x02)
|
||||
return "CK-D746 (4x6)";
|
||||
else if (brand == 0xff && type == 0x04)
|
||||
return "CK-D757 (5x7)";
|
||||
else if (brand == 0xff && type == 0x05)
|
||||
return "CK-D769 (6x9)";
|
||||
else if (brand == 0xff && type == 0x0f)
|
||||
return "CK-D768/CK-D868 (6x8)";
|
||||
else if (brand == 0x6c && type == 0x84)
|
||||
return "Kodak 5R (5x7)";
|
||||
else if (brand == 0x6c && type == 0x8f)
|
||||
return "Kodak 6R (6x8)";
|
||||
else if (brand == 0x61 && type == 0x84)
|
||||
return "CK-K57R (5x7)";
|
||||
else if (brand == 0x61 && type == 0x8f)
|
||||
return "CK-K76R (6x8)";
|
||||
else if (brand == 0x7a && type == 0x01)
|
||||
return "RL-CF900 (3.5x5)";
|
||||
else if (brand == 0x7a && type == 0x02)
|
||||
return "RK-CF800/4R (4x6)";
|
||||
else if (brand == 0x7a && type == 0x04)
|
||||
return "R2L-CF460/5R (5x7)";
|
||||
else if (brand == 0x7a && type == 0x0f)
|
||||
return "R68-CF400/6R (6x8)";
|
||||
else
|
||||
return "Unknown";
|
||||
|
||||
// Also CK-D715, CK-D718, CK-D720, CK-D723 (4x6,5x8,6x8,6x9) for D70-S model
|
||||
// CK-D746-U for D70-U model
|
||||
// CK-D820 (6x8) for D80-S model
|
||||
// D90 can use _all_ of these types except for the -U!
|
||||
|
||||
}
|
||||
|
||||
#define CMDBUF_LEN 512
|
||||
#define READBACK_LEN 256
|
||||
|
@ -695,7 +639,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
|
||||
/* Set up markers */
|
||||
ctx->marker[0].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[0].name = mitsu70x_media_types(resp.lower.media_brand, resp.lower.media_type);
|
||||
ctx->marker[0].name = mitsu_media_types(resp.lower.media_brand, resp.lower.media_type);
|
||||
ctx->marker[0].numtype = resp.lower.media_type;
|
||||
ctx->marker[0].levelmax = be16_to_cpu(resp.lower.capacity);
|
||||
ctx->marker[0].levelnow = be16_to_cpu(resp.lower.remain);
|
||||
|
@ -703,7 +647,7 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
|
||||
if (ctx->num_decks == 2) {
|
||||
ctx->marker[1].color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker[1].name = mitsu70x_media_types(resp.upper.media_brand, resp.upper.media_type);
|
||||
ctx->marker[1].name = mitsu_media_types(resp.upper.media_brand, resp.upper.media_type);
|
||||
ctx->marker[1].numtype = resp.upper.media_type;
|
||||
ctx->marker[1].levelmax = be16_to_cpu(resp.upper.capacity);
|
||||
ctx->marker[1].levelnow = be16_to_cpu(resp.upper.remain);
|
||||
|
@ -2065,11 +2009,11 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx,
|
|||
mitsu70x_errors(resp->lower.error_status),
|
||||
mitsu70x_errorrecovery(resp->lower.error_status));
|
||||
}
|
||||
INFO("Lower Temperature: %s\n", mitsu70x_temperatures(resp->lower.temperature));
|
||||
INFO("Lower Temperature: %s\n", mitsu_temperatures(resp->lower.temperature));
|
||||
INFO("Lower Mechanical Status: %s\n",
|
||||
mitsu70x_mechastatus(resp->lower.mecha_status));
|
||||
INFO("Lower Media Type: %s (%02x/%02x)\n",
|
||||
mitsu70x_media_types(resp->lower.media_brand, resp->lower.media_type),
|
||||
mitsu_media_types(resp->lower.media_brand, resp->lower.media_type),
|
||||
resp->lower.media_brand,
|
||||
resp->lower.media_type);
|
||||
INFO("Lower Prints Remaining: %03d/%03d\n",
|
||||
|
@ -2087,11 +2031,11 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx,
|
|||
mitsu70x_errors(resp->upper.error_status),
|
||||
mitsu70x_errorrecovery(resp->upper.error_status));
|
||||
}
|
||||
INFO("Upper Temperature: %s\n", mitsu70x_temperatures(resp->upper.temperature));
|
||||
INFO("Upper Temperature: %s\n", mitsu_temperatures(resp->upper.temperature));
|
||||
INFO("Upper Mechanical Status: %s\n",
|
||||
mitsu70x_mechastatus(resp->upper.mecha_status));
|
||||
INFO("Upper Media Type: %s (%02x/%02x)\n",
|
||||
mitsu70x_media_types(resp->upper.media_brand, resp->upper.media_type),
|
||||
mitsu_media_types(resp->upper.media_brand, resp->upper.media_type),
|
||||
resp->upper.media_brand,
|
||||
resp->upper.media_type);
|
||||
INFO("Upper Prints Remaining: %03d/%03d\n",
|
||||
|
@ -2130,7 +2074,7 @@ static int mitsu70x_query_jobs(struct mitsu70x_ctx *ctx)
|
|||
mitsu70x_errors(jobstatus.error_status),
|
||||
mitsu70x_errorrecovery(jobstatus.error_status));
|
||||
}
|
||||
INFO("Lower Deck Temperature: %s\n", mitsu70x_temperatures(jobstatus.temperature));
|
||||
INFO("Lower Deck Temperature: %s\n", mitsu_temperatures(jobstatus.temperature));
|
||||
|
||||
INFO("Upper Deck Mechanical Status: %s\n",
|
||||
mitsu70x_mechastatus(jobstatus.mecha_status_up));
|
||||
|
@ -2140,7 +2084,7 @@ static int mitsu70x_query_jobs(struct mitsu70x_ctx *ctx)
|
|||
mitsu70x_errors(jobstatus.error_status_up),
|
||||
mitsu70x_errorrecovery(jobstatus.error_status_up));
|
||||
}
|
||||
INFO("Upper Deck Temperature: %s\n", mitsu70x_temperatures(jobstatus.temperature_up));
|
||||
INFO("Upper Deck Temperature: %s\n", mitsu_temperatures(jobstatus.temperature_up));
|
||||
} else {
|
||||
INFO("Mechanical Status: %s\n",
|
||||
mitsu70x_mechastatus(jobstatus.mecha_status));
|
||||
|
@ -2150,7 +2094,7 @@ static int mitsu70x_query_jobs(struct mitsu70x_ctx *ctx)
|
|||
mitsu70x_errors(jobstatus.error_status),
|
||||
mitsu70x_errorrecovery(jobstatus.error_status));
|
||||
}
|
||||
INFO("Temperature: %s\n", mitsu70x_temperatures(jobstatus.temperature));
|
||||
INFO("Temperature: %s\n", mitsu_temperatures(jobstatus.temperature));
|
||||
}
|
||||
|
||||
// memory status?
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#define USB_VID_MITSU 0x06D3
|
||||
#define USB_PID_MITSU_D90 0x3B60
|
||||
|
||||
const char *mitsu70x_media_types(uint8_t brand, uint8_t type);
|
||||
const char *mitsu70x_temperatures(uint8_t temp);
|
||||
|
||||
/* Printer data structures */
|
||||
#define D90_STATUS_TYPE_MODEL 0x01 // 10, null-terminated ASCII. 'CPD90D'
|
||||
#define D90_STATUS_TYPE_x02 0x02 // 1, 0x5f ?
|
||||
|
@ -150,7 +147,8 @@ struct mitsud90_job_hdr {
|
|||
uint8_t hdr[6]; /* 1b 53 50 30 00 33 */
|
||||
uint16_t cols; /* BE */
|
||||
uint16_t rows; /* BE */
|
||||
uint8_t unk[4]; /* 64 00 00 01 */ // XXX 00 01 might be the jobid?
|
||||
uint8_t waittime; /* 0-100 */
|
||||
uint8_t unk[3]; /* 00 00 01 */ // XXX 00 01 might be the jobid?
|
||||
uint8_t margincut; /* 1 for enabled, 0 for disabled */
|
||||
union {
|
||||
#if 0
|
||||
|
@ -163,15 +161,15 @@ struct mitsud90_job_hdr {
|
|||
} __attribute__((packed));
|
||||
uint8_t zero[24];
|
||||
|
||||
/*@x30*/uint8_t overcoat;
|
||||
uint8_t quality;
|
||||
uint8_t colorcorr;
|
||||
uint8_t sharp_h;
|
||||
uint8_t sharp_v;
|
||||
/*@x30*/uint8_t overcoat; /* 0 glossy, matte is 2 (D90) or 3 (M1) */
|
||||
uint8_t quality; /* 0 is automatic */
|
||||
uint8_t colorcorr; /* Always 1 on M1 */
|
||||
uint8_t sharp_h; /* Always 0 on M1 */
|
||||
uint8_t sharp_v; /* Always 0 on M1 */
|
||||
uint8_t zero_b[5];
|
||||
union {
|
||||
struct {
|
||||
uint16_t pano_on; /* 0x0001 when pano is on, */
|
||||
uint16_t pano_on; /* 0x0001 when pano is on, or always 0x000a on M1 */
|
||||
uint8_t pano_tot; /* 2 or 3 */
|
||||
uint8_t pano_pg; /* 1, 2, 3 */
|
||||
uint16_t pano_rows; /* always 0x097c (BE), ie 2428 ie 8" print */
|
||||
|
@ -182,16 +180,22 @@ struct mitsud90_job_hdr {
|
|||
uint8_t zero_c[16];
|
||||
};
|
||||
uint8_t zero_d[6];
|
||||
uint8_t zero_fill[432];
|
||||
uint8_t zero_e[17];
|
||||
uint8_t rgbrate; /* M1 only */
|
||||
uint8_t oprate; /* M1 only */
|
||||
uint8_t zero_fill[413];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct mitsud90_plane_hdr {
|
||||
uint8_t hdr[6]; /* 1b 5a 54 01 00 09 */
|
||||
uint16_t origin_cols;
|
||||
uint16_t origin_rows;
|
||||
uint16_t origin_cols; /* Leave at 0 */
|
||||
uint16_t origin_rows; /* Leave at 0 */
|
||||
uint16_t cols; /* BE */
|
||||
uint16_t rows; /* BE */
|
||||
uint8_t zero_fill[498];
|
||||
uint8_t zero_a[6];
|
||||
uint16_t lamcols; /* BE (M1 only, OC=3) should be cols+origin_cols */
|
||||
uint16_t lamrows; /* BE (M1 only, OC=3) should be rows+origin_rows+12 */
|
||||
uint8_t zero_fill[488];
|
||||
};
|
||||
|
||||
struct mitsud90_job_footer {
|
||||
|
@ -406,7 +410,7 @@ static void mitsud90_dump_status(struct mitsud90_status_resp *resp)
|
|||
mitsud90_mecha_statuses(resp->mecha),
|
||||
resp->mecha[0], resp->mecha[1]);
|
||||
INFO("Temperature Status: %s\n",
|
||||
mitsu70x_temperatures(resp->temp));
|
||||
mitsu_temperatures(resp->temp));
|
||||
}
|
||||
|
||||
/* Private data structure */
|
||||
|
@ -584,7 +588,7 @@ static int mitsud90_attach(void *vctx, struct libusb_device_handle *dev, int typ
|
|||
|
||||
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
|
||||
ctx->marker.numtype = resp.media.type;
|
||||
ctx->marker.name = mitsu70x_media_types(resp.media.brand, resp.media.type);
|
||||
ctx->marker.name = mitsu_media_types(resp.media.brand, resp.media.type);
|
||||
ctx->marker.levelmax = be16_to_cpu(resp.media.capacity);
|
||||
ctx->marker.levelnow = be16_to_cpu(resp.media.remain);
|
||||
|
||||
|
@ -935,7 +939,7 @@ static int mitsud90_get_media(struct mitsud90_ctx *ctx)
|
|||
return CUPS_BACKEND_FAILED;
|
||||
|
||||
INFO("Media Type: %s (%02x/%02x)\n",
|
||||
mitsu70x_media_types(resp.media.brand, resp.media.type),
|
||||
mitsu_media_types(resp.media.brand, resp.media.type),
|
||||
resp.media.brand,
|
||||
resp.media.type);
|
||||
INFO("Prints Remaining: %03d/%03d\n",
|
||||
|
@ -1337,13 +1341,17 @@ struct dyesub_backend mitsud90_backend = {
|
|||
|
||||
[[HEADER 1]]
|
||||
|
||||
1b 53 50 30 00 33 XX XX YY YY 64 00 00 01 MM ?? XX XX == COLS, YY XX ROWS (BE)
|
||||
?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 00 00 00 00 <-- cut position, see below
|
||||
1b 53 50 30 00 33 XX XX YY YY TT 00 00 01 MM ?? XX XX == COLS, YY XX ROWS (BE)
|
||||
?? ?? ?? ?? ?? ?? ?? ?? 00 00 00 00 00 00 00 00 ?? = cut position, 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 01 00 03 II 09 7c QQ == 02 matte, 00 glossy,
|
||||
09 4c 00 00 02 58 00 0c 00 06 RR == 00 auto, 03 == fine, 02 == superfine.
|
||||
SS == 00 colorcorr, 01 == none
|
||||
HH/VV sharpening for Horiz/Vert, 0-8, 0 is off, 4 is normal
|
||||
QQ RR SS HH VV 00 00 00 00 00 ZZ 00 03 II 09 7c QQ == 02 matte (D90) or 03 (M1), 00 glossy,
|
||||
09 4c 00 00 02 58 00 0c 00 06 00 00 00 00 00 00 RR == 00 auto, 03 == fine, 02 == superfine.
|
||||
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 SS == 00 colorcorr, 01 == none (always 01 on M1)
|
||||
00 Z1 Z2 00 00 00 00 00 HH/VV sharpening for Horiz/Vert, 0-8, 0 is off, 4 is normal (always 00 on M1)
|
||||
TT is waittime (100 max, always 100 on D90)
|
||||
ZZ is 0a on M1, D90 see below
|
||||
Z1 is RGB Rate (M1)
|
||||
Z2 is OP Rate (M1)
|
||||
[pad to 512b]
|
||||
|
||||
normal == rows 00 00 00 00 00 00 00 00 00
|
||||
|
@ -1356,7 +1364,10 @@ struct dyesub_backend mitsud90_backend = {
|
|||
9x6div3 == 2724 00 03 90 00 07 14 00 00 00
|
||||
9x6div4 == 2628 00 02 97 00 05 22 00 07 ad
|
||||
|
||||
from [01 00 03 03] onwards, only shows in 8x20" PANORAMA prints. Assume 2" overlap.
|
||||
|
||||
|
||||
from [ZZ 00 03 03] onwards, only shows in 8x20" PANORAMA prints. Assume 2" overlap.
|
||||
ZZ == 00 (normal) or 01 (panorama)
|
||||
II == 01 02 03 (which panel # in panorama!)
|
||||
[02 58] == 600, aka 2" * 300dpi?
|
||||
[09 4c] == 2380 (48 less than 8 size? (trim length on ends?)
|
||||
|
@ -1431,7 +1442,7 @@ Comms Protocol for D90 & CP-M1
|
|||
|
||||
WW == 0x50 or 0x00 (seen, no idea what it means)
|
||||
VV == Media vendor (0xff etc)
|
||||
TT == Media type, 0x02/0x0f etc (see mitsu70x_media_types!)
|
||||
TT == Media type, 0x02/0x0f etc (see mitsu_media_types!)
|
||||
XX XX == Media capacity, BE
|
||||
YY YY == Media remain, BE
|
||||
QQ QQ == 00 00 normal, 3f 37 error
|
||||
|
@ -1739,15 +1750,12 @@ static int cpm1_fillmatte(struct mitsud90_printjob *job)
|
|||
|
||||
struct mitsud90_job_hdr *hdr = (struct mitsud90_job_hdr *) job->databuf;
|
||||
|
||||
// XXX fill out lamination header?
|
||||
ret = mitsu_readlamdata(MITSU_CPM1_LAMINATE_FILE, LAMINATE_STRIDE,
|
||||
job->databuf, &job->datalen,
|
||||
be16_to_cpu(hdr->rows), be16_to_cpu(hdr->cols), 1);
|
||||
be16_to_cpu(hdr->rows) + 12, be16_to_cpu(hdr->cols), 1);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
// XXX fill out footer?
|
||||
|
||||
return CUPS_BACKEND_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue