all: Move to using 'struct dyesub_job_common' in all backends

Should have done this a while ago.  Now I can finally modify the
common job structure in just one place
This commit is contained in:
Solomon Peachy 2021-09-30 14:52:11 -04:00
parent a396200bce
commit b5c7b5e53e
21 changed files with 125 additions and 128 deletions

View File

@ -513,8 +513,8 @@ done:
/* Private data structure */
struct canonselphy_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
int16_t paper_code;
uint8_t bw_mode;
@ -679,8 +679,8 @@ static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->jobsize = sizeof(*job);
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* The CP900 job *may* have a 4-byte null footer after the
job contents. Ignore it if it comes through here.. */
@ -828,7 +828,7 @@ static int canonselphy_main_loop(void *vctx, const void *vjob, int wait_for_retu
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
/* Read in the printer status to clear last state */
ret = read_data(ctx->conn,
@ -1098,7 +1098,7 @@ static const char *canonselphy_prefixes[] = {
const struct dyesub_backend canonselphy_backend = {
.name = "Canon SELPHY CP/ES (legacy)",
.version = "0.111",
.version = "0.112",
.uri_prefixes = canonselphy_prefixes,
.cmdline_usage = canonselphy_cmdline,
.cmdline_arg = canonselphy_cmdline_arg,

View File

@ -42,10 +42,10 @@ struct selphyneo_readback {
/* Private data structure */
struct selphyneo_printjob {
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
int copies;
};
struct selphyneo_ctx {
@ -240,7 +240,8 @@ static int selphyneo_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* Read the header.. */
i = read(data_fd, &hdr, sizeof(hdr));
@ -315,7 +316,7 @@ static int selphyneo_main_loop(void *vctx, const void *vjob, int wait_for_return
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
/* Read in the printer status to clear last state */
ret = read_data(ctx->conn,
@ -502,7 +503,7 @@ static const char *canonselphyneo_prefixes[] = {
const struct dyesub_backend canonselphyneo_backend = {
.name = "Canon SELPHY CP (new)",
.version = "0.21",
.version = "0.22",
.uri_prefixes = canonselphyneo_prefixes,
.cmdline_usage = selphyneo_cmdline,
.cmdline_arg = selphyneo_cmdline_arg,

View File

@ -227,7 +227,7 @@ struct dyesub_joblist {
};
#define MAX_JOBS_FROM_READ_PARSE 3
/* This should be the start of every per-printer job struct! */
/* This MUST be the start of every per-printer job struct! */
struct dyesub_job_common {
size_t jobsize;
int copies;

View File

@ -46,9 +46,7 @@
/* Private data structure */
struct dnpds40_printjob {
size_t jobsize;
int copies;
int can_combine;
struct dyesub_job_common common;
uint8_t *databuf;
int datalen;
@ -339,7 +337,7 @@ static void *dnp_combine_jobs(const void *vjob1,
newjob->datalen = 0;
newjob->multicut = new_multicut;
newjob->can_rewind = 0;
newjob->can_combine = 0;
newjob->common.can_combine = 0;
if (!newjob->databuf) {
dnpds40_cleanup_job(newjob);
newjob = NULL;
@ -1474,7 +1472,7 @@ static int dnpds40_read_parse(void *vctx, const void **vjob, int data_fd, int co
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->jobsize = sizeof(*job);
job->common.jobsize = sizeof(*job);
job->printspeed = -1;
/* There's no way to figure out the total job length in advance, we
@ -1579,7 +1577,7 @@ static int dnpds40_read_parse(void *vctx, const void **vjob, int data_fd, int co
/* Check for some offsets */
if(!memcmp("CNTRL QTY", job->databuf + job->datalen+2, 9)) {
memcpy(buf, job->databuf + job->datalen + 32, 8);
job->copies = atoi(buf);
job->common.copies = atoi(buf);
continue;
}
if(!memcmp("CNTRL CUTTER", job->databuf + job->datalen+2, 12)) {
@ -1700,8 +1698,8 @@ parsed:
}
/* Use the larger of the copy arguments */
if (job->copies < copies)
job->copies = copies;
if (job->common.copies < copies)
job->common.copies = copies;
/* Make sure advanced matte modes are supported */
if (job->matte > 100) {
@ -2134,7 +2132,7 @@ static int dnpds40_main_loop(void *vctx, const void *vjob, int wait_on_return) {
buf_needed = job->buf_needed;
multicut = job->multicut;
copies = job->copies;
copies = job->common.copies;
/* If we switch major overcoat modes, we need both buffers */
if (!!job->matte != ctx->last_matte)
@ -3484,7 +3482,7 @@ static const char *dnpds40_prefixes[] = {
const struct dyesub_backend dnpds40_backend = {
.name = "DNP DS-series / Citizen C-series",
.version = "0.143",
.version = "0.144",
.uri_prefixes = dnpds40_prefixes,
.cmdline_usage = dnpds40_cmdline,
.cmdline_arg = dnpds40_cmdline_arg,
@ -3674,7 +3672,7 @@ static int legacy_cw01_read_parse(struct dnpds40_printjob *job, int data_fd, int
job->cutter = 0;
/* Use job's copies */
job->copies = hdr.copies;
job->common.copies = hdr.copies;
return legacy_spool_helper(job, data_fd, read_data,
sizeof(hdr), plane_len, 0);
@ -3712,7 +3710,7 @@ static int legacy_dnp_read_parse(struct dnpds40_printjob *job, int data_fd, int
}
/* Use job's copies */
job->copies = hdr.copies;
job->common.copies = hdr.copies;
/* Don't bother with FW version checks for legacy stuff */
job->multicut = hdr.type + 1;
@ -3759,7 +3757,7 @@ static int legacy_dnp620_read_parse(struct dnpds40_printjob *job, int data_fd, i
}
/* Use job's copies */
job->copies = hdr.copies;
job->common.copies = hdr.copies;
/* Don't bother with FW version checks for legacy stuff */
job->multicut = hdr.type + 1;
@ -3804,7 +3802,7 @@ static int legacy_dnp820_read_parse(struct dnpds40_printjob *job, int data_fd, i
}
/* Use job's copies */
job->copies = hdr.copies;
job->common.copies = hdr.copies;
/* Don't bother with FW version checks for legacy stuff */
job->multicut = hdr.type + 1;

View File

@ -357,8 +357,7 @@ struct hiti_matrix {
/* Private data structure */
struct hiti_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
@ -1528,8 +1527,8 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* Read in header */
ret = read(data_fd, &job->hdr, sizeof(job->hdr));
@ -1565,8 +1564,8 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
}
/* Use whicever copy count is larger */
if (job->copies < (int)job->hdr.copies)
job->copies = job->hdr.copies;
if (job->common.copies < (int)job->hdr.copies)
job->common.copies = job->hdr.copies;
/* Sanity check printer type vs job type */
switch(ctx->conn->type)
@ -1852,7 +1851,7 @@ static int hiti_main_loop(void *vctx, const void *vjob, int wait_for_return)
sf.rows_offset = calc_offset(ctx->calibration.vert, 5, 8, 4);
sf.cols_offset = calc_offset(ctx->calibration.horiz, 6, 11, 4);
sf.colorSeq = 0x87 + (job->hdr.overcoat ? 0xc0 : 0);
sf.copies = job->copies;
sf.copies = job->common.copies;
sf.printMode = 0x08 + (job->hdr.quality ? 0x02 : 0);
ret = hiti_docmd(ctx, CMD_EFD_SF, (uint8_t*) &sf, sizeof(sf), &resplen);
if (ret)
@ -2407,7 +2406,7 @@ static const char *hiti_prefixes[] = {
const struct dyesub_backend hiti_backend = {
.name = "HiTi Photo Printers",
.version = "0.32",
.version = "0.33",
.uri_prefixes = hiti_prefixes,
.cmdline_usage = hiti_cmdline,
.cmdline_arg = hiti_cmdline_arg,

View File

@ -62,11 +62,9 @@ struct kodak1400_hdr {
uint8_t null4[12];
} __attribute__((packed));
/* Private data structure */
struct kodak1400_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
struct kodak1400_hdr hdr;
uint8_t *plane_r;
@ -341,7 +339,8 @@ static int kodak1400_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* Read in then validate header */
ret = read(data_fd, &job->hdr, sizeof(job->hdr));
@ -431,7 +430,7 @@ static int kodak1400_main_loop(void *vctx, const void *vjob, int wait_for_return
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
top:
if (state != last_state) {
@ -638,7 +637,7 @@ static const char *kodak1400_prefixes[] = {
const struct dyesub_backend kodak1400_backend = {
.name = "Kodak 1400/805",
.version = "0.43",
.version = "0.44",
.uri_prefixes = kodak1400_prefixes,
.cmdline_usage = kodak1400_cmdline,
.cmdline_arg = kodak1400_cmdline_arg,

View File

@ -421,9 +421,9 @@ static int kodak605_read_parse(void *vctx, const void **vjob, int data_fd, int c
return ret;
}
/* Printer handles generating copies. Use larger of our options */
if (le16_to_cpu(job->jp.copies) < (uint16_t)copies)
job->jp.copies = cpu_to_le16(copies);
/* Use larger of our copy counts */
if (job->common.copies < copies)
job->common.copies = copies;
*vjob = job;
@ -563,7 +563,7 @@ static int kodak605_main_loop(void *vctx, const void *vjob, int wait_for_return)
hdr.jobid = ctx->jobid;
hdr.rows = cpu_to_le16(job->jp.rows);
hdr.columns = cpu_to_le16(job->jp.columns);
hdr.copies = cpu_to_le16(job->jp.copies);
hdr.copies = cpu_to_le16(job->common.copies);
hdr.media = job->jp.media;
hdr.oc_mode = job->jp.oc_mode;
hdr.method = job->jp.method;

View File

@ -837,11 +837,12 @@ static int kodak6800_read_parse(void *vctx, const void **vjob, int data_fd, int
hdr.copies = be16_to_cpu(hdr.copies);
hdr.copies = packed_bcd_to_uint32((char*)&hdr.copies, 2);
/* Use larger of our copy counts */
if (hdr.copies > copies)
copies = hdr.copies;
/* Fill out job structure */
job->jp.copies = copies;
job->common.copies = copies;
job->jp.rows = rows;
job->jp.columns = cols;
job->jp.media = hdr.size;
@ -866,7 +867,7 @@ static int kodak6800_main_loop(void *vctx, const void *vjob, int wait_for_return
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->jp.copies;
copies = job->common.copies;
/* Validate against supported media list */
for (num = 0 ; num < ctx->media_count; num++) {
@ -1062,7 +1063,7 @@ static const char *kodak6800_prefixes[] = {
/* Exported */
const struct dyesub_backend kodak6800_backend = {
.name = "Kodak 6800/6850",
.version = "0.80" " (lib " LIBSINFONIA_VER ")",
.version = "0.81" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = kodak6800_prefixes,
.cmdline_usage = kodak6800_cmdline,
.cmdline_arg = kodak6800_cmdline_arg,

View File

@ -91,11 +91,12 @@ static uint8_t gammas[2][256] = {
};
struct magicard_printjob {
struct dyesub_job_common common;
uint8_t *databuf;
int datalen;
int hdr_len;
int copies;
};
/* Private data structure */
@ -547,7 +548,8 @@ static int magicard_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* Read in the first chunk */
i = read(data_fd, initial_buf, INITIAL_BUF_LEN);
@ -832,7 +834,7 @@ static int magicard_main_loop(void *vctx, const void *vjob, int wait_for_return)
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
top:
if ((ret = send_data(ctx->conn,
job->databuf, job->hdr_len)))
@ -921,7 +923,7 @@ static const char *magicard_prefixes[] = {
const struct dyesub_backend magicard_backend = {
.name = "Magicard family",
.version = "0.17",
.version = "0.18",
.uri_prefixes = magicard_prefixes,
.cmdline_arg = magicard_cmdline_arg,
.cmdline_usage = magicard_cmdline,

View File

@ -37,9 +37,7 @@
/* Private data structure */
struct mitsu70x_printjob {
size_t jobsize;
int copies;
int can_combine;
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
@ -892,8 +890,8 @@ static int mitsu70x_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->jobsize = sizeof(*job);
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
repeat:
/* Read in initial header */
@ -1191,7 +1189,7 @@ bypass_raw:
}
/* 6x4 can be combined, only on 6x8/6x9" media. */
job->can_combine = 0;
job->common.can_combine = 0;
if (job->decks_exact[0] ||
job->decks_exact[1]) {
/* Exact media match, don't combine. */
@ -1201,12 +1199,12 @@ bypass_raw:
ctx->medias[0] == 0x5 ||
ctx->medias[1] == 0xf || /* Two decks possible */
ctx->medias[1] == 0x5)
job->can_combine = !job->raw_format;
job->common.can_combine = !job->raw_format;
} else if (job->rows == 1076) {
if (ctx->conn->type == P_KODAK_305 ||
ctx->conn->type == P_MITSU_K60) {
if (ctx->medias[0] == 0x4) /* Only one deck */
job->can_combine = !job->raw_format;
job->common.can_combine = !job->raw_format;
}
}
@ -1744,7 +1742,7 @@ static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return)
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
hdr = (struct mitsu70x_hdr*) job->databuf;
/* Keep track of deck requested */
@ -2585,7 +2583,7 @@ static const char *mitsu70x_prefixes[] = {
/* Exported */
const struct dyesub_backend mitsu70x_backend = {
.name = "Mitsubishi CP-D70 family",
.version = "0.105" " (lib " LIBMITSU_VER ")",
.version = "0.106" " (lib " LIBMITSU_VER ")",
.flags = BACKEND_FLAG_DUMMYPRINT,
.uri_prefixes = mitsu70x_prefixes,
.cmdline_usage = mitsu70x_cmdline,

View File

@ -89,8 +89,7 @@ struct mitsu9550_cmd {
/* Private data structure */
struct mitsu9550_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
@ -464,8 +463,8 @@ static int mitsu9550_read_parse(void *vctx, const void **vjob, int data_fd, int
}
memset(job, 0, sizeof(*job));
job->is_raw = 1;
job->jobsize = sizeof(*job);
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
top:
/* Read in initial header */
@ -723,12 +722,13 @@ hdr_done:
}
/* Update printjob header to reflect number of requested copies */
// XXX use larger?
if (job->hdr2_present) {
if (be16_to_cpu(job->hdr2.copies) < copies)
job->hdr2.copies = cpu_to_be16(copies);
copies = 1;
}
job->copies = copies;
job->common.copies = copies;
/* All further work is in main loop */
if (test_mode >= TEST_MODE_NOPRINT)
@ -1612,7 +1612,7 @@ static const char *mitsu9550_prefixes[] = {
/* Exported */
const struct dyesub_backend mitsu9550_backend = {
.name = "Mitsubishi CP9xxx family",
.version = "0.62" " (lib " LIBMITSU_VER ")",
.version = "0.63" " (lib " LIBMITSU_VER ")",
.uri_prefixes = mitsu9550_prefixes,
.cmdline_usage = mitsu9550_cmdline,
.cmdline_arg = mitsu9550_cmdline_arg,

View File

@ -449,8 +449,7 @@ static void mitsud90_dump_status(struct mitsud90_status_resp *resp)
/* Private data structure */
struct mitsud90_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
@ -819,8 +818,8 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->jobsize = sizeof(*job);
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
/* Read in header */
uint8_t *hptr = (uint8_t*) &job->hdr;
@ -1069,7 +1068,7 @@ static int mitsud90_main_loop(void *vctx, const void *vjob, int wait_for_return)
return CUPS_BACKEND_FAILED;
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
/* Handle panorama state */
if (ctx->conn->type == P_MITSU_D90) {
@ -1999,7 +1998,7 @@ static const char *mitsud90_prefixes[] = {
/* Exported */
const struct dyesub_backend mitsud90_backend = {
.name = "Mitsubishi CP-D90/CP-M1",
.version = "0.36" " (lib " LIBMITSU_VER ")",
.version = "0.37" " (lib " LIBMITSU_VER ")",
.uri_prefixes = mitsud90_prefixes,
.cmdline_arg = mitsud90_cmdline_arg,
.cmdline_usage = mitsud90_cmdline,

View File

@ -34,6 +34,8 @@
/* Private data structure */
struct mitsup95d_printjob {
struct dyesub_job_common common;
uint8_t *databuf;
uint32_t datalen;
@ -191,6 +193,7 @@ static int mitsup95d_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->common.jobsize = sizeof(*job);
job->mem_clr_present = 0;
@ -341,6 +344,8 @@ top:
if (copies > job->hdr2[13])
job->hdr2[13] = copies;
job->common.copies = copies; // XXX use larger?
*vjob = job;
return CUPS_BACKEND_OK;
}
@ -602,7 +607,7 @@ static const char *mitsup95d_prefixes[] = {
/* Exported */
const struct dyesub_backend mitsup95d_backend = {
.name = "Mitsubishi P93D/P95D",
.version = "0.15",
.version = "0.16",
.uri_prefixes = mitsup95d_prefixes,
.cmdline_arg = mitsup95d_cmdline_arg,
.cmdline_usage = mitsup95d_cmdline,

View File

@ -988,6 +988,7 @@ static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->common.jobsize = sizeof(*job);
/* Common read/parse code */
ret = sinfonia_read_parse(data_fd, 1245, job);
@ -997,10 +998,8 @@ static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, in
}
/* Use larger of our copy counts */
if ((int)job->jp.copies > copies)
job->copies = job->jp.copies;
else
job->copies = copies;
if (job->common.copies < copies)
job->common.copies = copies;
*vjob = job;
return CUPS_BACKEND_OK;
@ -1019,7 +1018,7 @@ static int shinkos1245_main_loop(void *vctx, const void *vjob, int wait_for_retu
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
/* Make sure print size is supported */
for (i = 0 ; i < ctx->num_medias ; i++) {
@ -1282,7 +1281,7 @@ static const char *shinkos1245_prefixes[] = {
const struct dyesub_backend shinkos1245_backend = {
.name = "Shinko/Sinfonia CHC-S1245/E1",
.version = "0.34" " (lib " LIBSINFONIA_VER ")",
.version = "0.35" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos1245_prefixes,
.cmdline_usage = shinkos1245_cmdline,
.cmdline_arg = shinkos1245_cmdline_arg,

View File

@ -913,10 +913,8 @@ static int shinkos2145_read_parse(void *vctx, const void **vjob, int data_fd, in
}
/* Use whicever copy count is larger */
if ((int)job->jp.copies > copies)
job->copies = job->jp.copies;
else
job->copies = copies;
if (job->common.copies < copies)
job->common.copies = copies;
*vjob = job;
@ -1019,7 +1017,7 @@ top:
print.hdr.len = cpu_to_le16(sizeof(print) - sizeof(print.hdr));
print.jobid = ctx->jobid;
print.copies = cpu_to_le16(job->copies);
print.copies = cpu_to_le16(job->common.copies);
print.columns = cpu_to_le16(job->jp.columns);
print.rows = cpu_to_le16(job->jp.rows);
print.media = job->jp.media;
@ -1224,7 +1222,7 @@ static const char *shinkos2145_prefixes[] = {
const struct dyesub_backend shinkos2145_backend = {
.name = "Shinko/Sinfonia CHC-S2145/S2",
.version = "0.66" " (lib " LIBSINFONIA_VER ")",
.version = "0.67" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos2145_prefixes,
.cmdline_usage = shinkos2145_cmdline,
.cmdline_arg = shinkos2145_cmdline_arg,

View File

@ -1329,7 +1329,6 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->jobsize = sizeof(*job);
/* Common read/parse code */
if (ctx->dev.conn->type == P_KODAK_6900) {
@ -1343,10 +1342,8 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in
}
/* Use whicever copy count is larger */
if ((int)job->jp.copies > copies)
job->copies = job->jp.copies;
else
job->copies = copies;
if (job->common.copies < copies)
job->common.copies = copies;
/* S6145 can only combine 2* 4x6 -> 8x6.
2x6 strips and 3.5x5 -> 5x7 can't.
@ -1358,9 +1355,9 @@ static int shinkos6145_read_parse(void *vctx, const void **vjob, int data_fd, in
ctx->media.ribbon_code == RIBBON_6x9)) {
if (model == 6145 && job->jp.method == PRINT_METHOD_STD)
job->can_combine = 1;
job->common.can_combine = 1;
else if (model == 2245)
job->can_combine = 1;
job->common.can_combine = 1;
}
/* Extended spool format to re-purpose an unused header field.
@ -1735,7 +1732,7 @@ top:
print.hdr.len = cpu_to_le16(sizeof (print) - sizeof(cmd));
print.id = ctx->jobid;
print.count = cpu_to_le16(job->copies);
print.count = cpu_to_le16(job->common.copies);
print.columns = cpu_to_le16(job->jp.columns);
print.rows = cpu_to_le16(job->jp.rows);
print.image_avg = ctx->image_avg[2]; /* Cyan level */
@ -1759,7 +1756,7 @@ top:
print.hdr.cmd = cpu_to_le16(SINFONIA_CMD_PRINTJOB);
print.hdr.len = cpu_to_le16(sizeof (print) - sizeof(cmd));
print.jobid = ctx->jobid;
print.copies = cpu_to_le16(job->copies);
print.copies = cpu_to_le16(job->common.copies);
print.columns = cpu_to_le16(job->jp.columns);
print.rows = cpu_to_le16(job->jp.rows);
print.options = job->jp.oc_mode & 0x3;
@ -1964,7 +1961,7 @@ static const char *shinkos6145_prefixes[] = {
const struct dyesub_backend shinkos6145_backend = {
.name = "Shinko/Sinfonia CHC-S6145/CS2/S2245/S3",
.version = "0.48" " (lib " LIBSINFONIA_VER ")",
.version = "0.49" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos6145_prefixes,
.cmdline_usage = shinkos6145_cmdline,
.cmdline_arg = shinkos6145_cmdline_arg,

View File

@ -976,17 +976,15 @@ static int shinkos6245_read_parse(void *vctx, const void **vjob, int data_fd, in
return ret;
}
/* Use whicever copy count is larger */
if ((int)job->jp.copies > copies)
job->copies = job->jp.copies;
else
job->copies = copies;
/* Use larger of our copy counts */
if (job->common.copies < copies)
job->common.copies = copies;
if (ctx->dev.conn->type == P_KODAK_8810 &&
job->jp.rows > 3624) {
if (job->copies > 1) {
if (job->common.copies > 1) {
WARNING("Multiple copies of panorama prints is not supported!\n");
job->copies = 1;
job->common.copies = 1;
}
if (job->jp.media) {
@ -1091,7 +1089,7 @@ static int shinkos6245_main_loop(void *vctx, const void *vjob, int wait_for_retu
struct sinfonia_printjob *job = (struct sinfonia_printjob*) vjob;
struct kodak8810_cutlist *cutlist = NULL;
copies = job->copies;
copies = job->common.copies;
/* Cap copies */
if (ctx->dev.conn->type == P_KODAK_8810) {
@ -1469,7 +1467,7 @@ static const char *shinkos6245_prefixes[] = {
const struct dyesub_backend shinkos6245_backend = {
.name = "Sinfonia CHC-S6245 / Kodak 8810",
.version = "0.42" " (lib " LIBSINFONIA_VER ")",
.version = "0.43" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos6245_prefixes,
.cmdline_usage = shinkos6245_cmdline,
.cmdline_arg = shinkos6245_cmdline_arg,

View File

@ -34,6 +34,8 @@ int sinfonia_read_parse(int data_fd, uint32_t model,
int ret, i;
uint8_t tmpbuf[4];
job->common.jobsize = sizeof(*job);
/* Read in header */
ret = read(data_fd, hdr, SINFONIA_HDR_LEN);
if (ret < 0 || ret != SINFONIA_HDR_LEN) {
@ -129,7 +131,7 @@ int sinfonia_read_parse(int data_fd, uint32_t model,
}
job->jp.columns = hdr[13];
job->jp.rows = hdr[14];
job->jp.copies = hdr[15];
job->common.copies = hdr[15];
if (hdr[1] == 2245 || hdr[1] == 6145)
job->jp.ext_flags = hdr[28];
@ -142,6 +144,8 @@ int sinfonia_raw10_read_parse(int data_fd, struct sinfonia_printjob *job)
struct sinfonia_printcmd10_hdr hdr;
int ret;
job->common.jobsize = sizeof(*job);
/* Read in header */
ret = read(data_fd, &hdr, sizeof(hdr));
if (ret < 0 || ret != sizeof(hdr)) {
@ -158,7 +162,7 @@ int sinfonia_raw10_read_parse(int data_fd, struct sinfonia_printjob *job)
ERROR("Unrecognized data format!\n");
return CUPS_BACKEND_CANCEL;
}
job->jp.copies = le16_to_cpu(hdr.copies);
job->common.copies = le16_to_cpu(hdr.copies);
job->jp.rows = le16_to_cpu(hdr.rows);
job->jp.columns = le16_to_cpu(hdr.columns);
job->jp.media = hdr.media;
@ -169,8 +173,8 @@ int sinfonia_raw10_read_parse(int data_fd, struct sinfonia_printjob *job)
job->datalen = job->jp.rows * job->jp.columns * 3;
/* Hack in backprinting */
if (job->jp.copies & 0x8000) {
job->jp.copies &= ~0x8000;
if (job->common.copies & 0x8000) {
job->common.copies &= ~0x8000;
job->datalen += (44 * 2);
job->jp.ext_flags = EXT_FLAG_BACKPRINT;
}
@ -335,6 +339,8 @@ int sinfonia_raw18_read_parse(int data_fd, struct sinfonia_printjob *job)
struct sinfonia_printcmd18_hdr hdr;
int ret;
job->common.jobsize = sizeof(*job);
/* Read in header */
ret = read(data_fd, &hdr, sizeof(hdr));
if (ret < 0 || ret != sizeof(hdr)) {
@ -351,7 +357,7 @@ int sinfonia_raw18_read_parse(int data_fd, struct sinfonia_printjob *job)
ERROR("Unrecognized data format!\n");
return CUPS_BACKEND_CANCEL;
}
job->jp.copies = le16_to_cpu(hdr.copies);
job->common.copies = le16_to_cpu(hdr.copies);
job->jp.rows = le16_to_cpu(hdr.rows);
job->jp.columns = le16_to_cpu(hdr.columns);
job->jp.media = hdr.media;
@ -390,6 +396,8 @@ int sinfonia_raw28_read_parse(int data_fd, struct sinfonia_printjob *job)
struct sinfonia_printcmd28_hdr hdr;
int ret;
job->common.jobsize = sizeof(*job);
/* Read in header */
ret = read(data_fd, &hdr, sizeof(hdr));
if (ret < 0 || ret != sizeof(hdr)) {
@ -406,7 +414,7 @@ int sinfonia_raw28_read_parse(int data_fd, struct sinfonia_printjob *job)
ERROR("Unrecognized data format!\n");
return CUPS_BACKEND_CANCEL;
}
job->jp.copies = le16_to_cpu(hdr.copies);
job->common.copies = le16_to_cpu(hdr.copies);
job->jp.rows = le16_to_cpu(hdr.rows);
job->jp.columns = le16_to_cpu(hdr.columns);
job->jp.media = hdr.media;

View File

@ -24,7 +24,7 @@
*
*/
#define LIBSINFONIA_VER "0.18"
#define LIBSINFONIA_VER "0.19"
#define SINFONIA_HDR1_LEN 0x10
#define SINFONIA_HDR2_LEN 0x64
@ -34,7 +34,6 @@
struct sinfonia_job_param {
uint32_t columns;
uint32_t rows;
uint32_t copies;
uint32_t method;
uint32_t media;
@ -52,10 +51,7 @@ struct sinfonia_job_param {
#define EXT_FLAG_DOUBLESLUG 0x04
struct sinfonia_printjob {
size_t jobsize;
int copies;
int can_combine;
struct dyesub_job_common common;
struct sinfonia_job_param jp;
uint8_t *databuf;

View File

@ -77,8 +77,7 @@ struct sony_prints {
/* Private data structures */
struct upd_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
uint8_t *databuf;
int datalen;
@ -327,7 +326,8 @@ static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies
return CUPS_BACKEND_RETRY_CURRENT;
}
memset(job, 0, sizeof(*job));
job->copies = copies;
job->common.jobsize = sizeof(*job);
job->common.copies = copies;
job->datalen = 0;
job->databuf = malloc(MAX_PRINTJOB_LEN);
@ -483,7 +483,7 @@ static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies
tmp = cpu_to_be16(copies);
memcpy(job->databuf + copies_offset, &tmp, sizeof(tmp));
}
job->copies = 1;
job->common.copies = 1;
}
/* Parse some other stuff */
@ -524,7 +524,7 @@ static int upd_main_loop(void *vctx, const void *vjob, int wait_for_return) {
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
top:
/* Send Unknown CMD. Resets? */
@ -741,7 +741,7 @@ static const char *sonyupd_prefixes[] = {
const struct dyesub_backend sonyupd_backend = {
.name = "Sony UP-D",
.version = "0.45",
.version = "0.46",
.uri_prefixes = sonyupd_prefixes,
.cmdline_arg = upd_cmdline_arg,
.cmdline_usage = upd_cmdline,

View File

@ -30,8 +30,7 @@
/* Private data structures */
struct updneo_printjob {
size_t jobsize;
int copies;
struct dyesub_job_common common;
uint8_t *databuf;
int datalen;
@ -389,7 +388,7 @@ static int updneo_read_parse(void *vctx, const void **vjob, int data_fd, int cop
break;
}
}
job->copies = 1; /* Printer makes copies */
job->common.copies = 1; /* Printer makes copies */
*vjob = job;
@ -546,7 +545,7 @@ static int updneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
if (!job)
return CUPS_BACKEND_FAILED;
copies = job->copies;
copies = job->common.copies;
top:
@ -699,7 +698,7 @@ static const char *sonyupdneo_prefixes[] = {
const struct dyesub_backend sonyupdneo_backend = {
.name = "Sony UP-D Neo",
.version = "0.17",
.version = "0.18",
.flags = BACKEND_FLAG_BADISERIAL, /* UP-D898MD at least */
.uri_prefixes = sonyupdneo_prefixes,
.cmdline_arg = updneo_cmdline_arg,