dnp: Handle the 4x3, 4.5x3, 4x4. and 5,4.5x4 sizes.

These have unique MULTICUT values.   There's a gap in the sequence
that lends me to think there's another size in play, but dunno.

Updates to Gutenprint will follow
This commit is contained in:
Solomon Peachy 2022-10-03 15:50:23 -04:00
parent 89700f105f
commit 642a150101
1 changed files with 59 additions and 16 deletions

View File

@ -192,12 +192,19 @@ struct dnpds40_cmd {
#define MULTICUT_4_5x6 51
#define MULTICUT_4_5x8 52
// #define MULTICUT_4x3 XXX // 1266x936
// #define MULTICUT_4x3X2 XXX
// #define MULTICUT_4x4X2 XXX
// #define MULTICUT_4_5x3 XXX // 1408x936
// #define MULTICUT_4_5x3X2 XXX
// #define MULTICUT_4_5x4X2 XXX
#define MULTICUT_4x3 53
#define MULTICUT_4x4_5 54
#define MULTICUT_4_5x3 55
// #define MULTICUT_??? 56 // XXX WTF is missing?
#define MULTICUT_4_5x4 57
#if 0
// XXX do these exist? Or are they just the larger print cut in two?
// #define MULTICUT_4x3X2
// #define MULTICUT_4x4X2
// #define MULTICUT_4_5x3X2
// #define MULTICUT_4_5x4X2
#endif
#define MULTICUT_S_SIMPLEX 100
#define MULTICUT_S_FRONT 200
@ -320,6 +327,33 @@ static void *dnp_combine_jobs(const void *vjob1,
new_h = 3702;
gap_bytes = 30;
break;
#if 0 // XXX Do these printers handle automatic multicut?
// if not, implement using FULL_CUTTER_CONTROL!
case MULTICUT_4x3:
new_multicut = MULTICUT_4x6;
new_w = 1408;
new_h = 1836;
gap_bytes = 36;
break;
case MULTICUT_4x4:
new_multicut = MULTICUT_4x8;
new_w = 1408;
new_h = 2436;
gap_bytes = 36;
break;
case MULTICUT_4_5x3:
new_multicut = MULTICUT_4_5x6;
new_w = 1408;
new_h = 1836;
gap_bytes = 36;
break;
case MULTICUT_4_5x4:
new_multicut = MULTICUT_4_5x8;
new_w = 1408;
new_h = 2436;
gap_bytes = 36;
break;
#endif
default:
/* Everything else is NOT handled */
goto done;
@ -1883,8 +1917,9 @@ parsed:
if (job->multicut < 100) {
switch(ctx->media) {
case 150: // 4x6, QW410
if (job->multicut != MULTICUT_4x4 &&
// XXX job->multicut != MULTICUT_4x3 &&
if(job->multicut != MULTICUT_4x3 &&
job->multicut != MULTICUT_4x4 &&
job->multicut != MULTICUT_4x4_5 &&
// XXX job->multicut != MULTICUT_4x3X2 &&
job->multicut != MULTICUT_4x6) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -1893,9 +1928,10 @@ parsed:
}
break;
case 151: // 4x8, QW410
if (job->multicut != MULTICUT_4x4 &&
if (job->multicut != MULTICUT_4x3 &&
job->multicut != MULTICUT_4x4 &&
job->multicut != MULTICUT_4x4_5 &&
job->multicut != MULTICUT_4x6 &&
// XXX job->multicut != MULTICUT_4x3 &&
// XXX job->multicut != MULTICUT_4x3X2 &&
// XXX job->multicut != MULTICUT_4x4X2 &&
job->multicut != MULTICUT_4x8) {
@ -1905,7 +1941,9 @@ parsed:
}
break;
case 160: // 4.5x6, QW410
if (job->multicut != MULTICUT_4_5x4_5 &&
if (job->multicut != MULTICUT_4_5x3 &&
job->multicut != MULTICUT_4_5x4 &&
job->multicut != MULTICUT_4_5x4_5 &&
// XXX job->multicut != MULTICUT_4_5x3X2 &&
job->multicut != MULTICUT_4_5x6) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -1914,9 +1952,11 @@ parsed:
}
break;
case 161: // 4.5x8, QW410
if (job->multicut != MULTICUT_4_5x4_5 &&
if (job->multicut != MULTICUT_4_5x3 &&
job->multicut != MULTICUT_4_5x4 &&
job->multicut != MULTICUT_4_5x4_5 &&
job->multicut != MULTICUT_4_5x6 &&
// XXX job->multicut != MULTICUT_4_5x4_X2 &&
// XXX job->multicut != MULTICUT_4_5x4X2 &&
// XXX job->multicut != MULTICUT_4_5x3X2 &&
job->multicut != MULTICUT_4_5x8) {
ERROR("Incorrect media for job loaded (%u vs %u)\n", ctx->media, job->multicut);
@ -3510,7 +3550,7 @@ static const char *dnpds40_prefixes[] = {
const struct dyesub_backend dnpds40_backend = {
.name = "DNP DS-series / Citizen C-series",
.version = "0.145",
.version = "0.146",
.uri_prefixes = dnpds40_prefixes,
.cmdline_usage = dnpds40_cmdline,
.cmdline_arg = dnpds40_cmdline_arg,
@ -3863,7 +3903,9 @@ struct qw410_spool_hdr {
uint8_t null3[3];
uint8_t hd;
uint8_t null4[7];
uint8_t null4[3];
uint8_t dc;
uint8_t null5[3];
} __attribute__((packed));
static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, int read_data)
@ -3877,7 +3919,7 @@ static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, in
/* Early parsing and sanity checking */
plane_len = le32_to_cpu(hdr.plane_len);
if (hdr.type < MULTICUT_4x4 || hdr.type > MULTICUT_4_5x8 ||
if (hdr.type < MULTICUT_4x4 || hdr.type > MULTICUT_4_5x4 ||
hdr.null0[0] || hdr.null0[1] || hdr.null0[2]) {
ERROR("Unrecognized header data format @%d!\n", job->datalen);
return CUPS_BACKEND_CANCEL;
@ -3888,6 +3930,7 @@ static int legacy_qw410_read_parse(struct dnpds40_printjob *job, int data_fd, in
job->matte = hdr.matte;
job->cutter = (hdr.cut2) ? 120 : 0;
job->printspeed = (hdr.hd) ? 3 : 0;
// XXX decurl = hdr.dc (Decurl: 2 = auto, 1 = on, 0 = off)
return legacy_spool_helper(job, data_fd, read_data,
sizeof(hdr), plane_len, 1);