summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2021-09-30 11:37:14 -0400
committerSolomon Peachy <pizza@shaftnet.org>2021-09-30 13:55:27 -0400
commit4ecb80ed9c1abe98c8ffa44c52a82116fa23cd45 (patch)
tree64515cb99b1c5bd063be7896841309474236be13
parent1f959e4468a24e6ec02a04c917ade7bcbb8bf6b2 (diff)
downloadselphy_print-4ecb80ed9c1abe98c8ffa44c52a82116fa23cd45.tar.gz
selphy_print-4ecb80ed9c1abe98c8ffa44c52a82116fa23cd45.tar.bz2
selphy_print-4ecb80ed9c1abe98c8ffa44c52a82116fa23cd45.zip
all: make "fast_return" only affect the final print in a job.
That way we can take advantage of printer pipelining within a job even when fast_return is turned off. This refactoring was also necessary for further changes in how fast_return will work.
-rw-r--r--backend_canonselphy.c3
-rw-r--r--backend_canonselphyneo.c4
-rw-r--r--backend_common.c8
-rw-r--r--backend_common.h2
-rw-r--r--backend_dnpds40.c6
-rw-r--r--backend_hiti.c4
-rw-r--r--backend_kodak1400.c4
-rw-r--r--backend_kodak605.c4
-rw-r--r--backend_kodak6800.c4
-rw-r--r--backend_kodak8800.c4
-rw-r--r--backend_magicard.c3
-rw-r--r--backend_mitsu70x.c6
-rw-r--r--backend_mitsu9550.c14
-rw-r--r--backend_mitsud90.c8
-rw-r--r--backend_mitsup95d.c6
-rw-r--r--backend_shinkos1245.c4
-rw-r--r--backend_shinkos2145.c4
-rw-r--r--backend_shinkos6145.c4
-rw-r--r--backend_shinkos6245.c4
-rw-r--r--backend_sonyupd.c4
-rw-r--r--backend_sonyupdneo.c4
21 files changed, 56 insertions, 48 deletions
diff --git a/backend_canonselphy.c b/backend_canonselphy.c
index b7f7483..6603538 100644
--- a/backend_canonselphy.c
+++ b/backend_canonselphy.c
@@ -812,13 +812,14 @@ static int canonselphy_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
-static int canonselphy_main_loop(void *vctx, const void *vjob) {
+static int canonselphy_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct canonselphy_ctx *ctx = vctx;
uint8_t rdbuf[READBACK_LEN], rdbuf2[READBACK_LEN];
int last_state = -1, state = S_IDLE;
int ret, num;
int copies;
+ (void)wait_for_return;
const struct canonselphy_printjob *job = vjob;
diff --git a/backend_canonselphyneo.c b/backend_canonselphyneo.c
index 146fcda..69a8236 100644
--- a/backend_canonselphyneo.c
+++ b/backend_canonselphyneo.c
@@ -301,7 +301,7 @@ static int selphyneo_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
-static int selphyneo_main_loop(void *vctx, const void *vjob) {
+static int selphyneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct selphyneo_ctx *ctx = vctx;
struct selphyneo_readback rdback;
@@ -410,7 +410,7 @@ top:
return CUPS_BACKEND_STOP;
}
- if (rdback.data[0] > 0x02 && fast_return && copies <= 1) {
+ if (rdback.data[0] > 0x02 && !wait_for_return && copies <= 1) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_common.c b/backend_common.c
index 4b8c472..e72bb07 100644
--- a/backend_common.c
+++ b/backend_common.c
@@ -29,7 +29,7 @@
#include <signal.h>
#include <strings.h> /* For strncasecmp */
-#define BACKEND_VERSION "0.119"
+#define BACKEND_VERSION "0.120"
#ifndef CORRTABLE_PATH
#ifdef PACKAGE_DATA_DIR
@@ -2000,6 +2000,10 @@ int dyesub_joblist_print(const struct dyesub_joblist *list, int *pagenum)
for (i = 0 ; i < list->copies ; i++) {
for (j = 0 ; j < list->num_entries ; j++) {
+ int wait_on_return = 0;
+ if (i == (list->copies - 1) && j == (list->num_entries -1))
+ wait_on_return = fast_return; /* only wait on the final iteration. */
+
if (list->entries[j]) {
int copies = ((const struct dyesub_job_common *)(list->entries[j]))->copies;
@@ -2010,7 +2014,7 @@ int dyesub_joblist_print(const struct dyesub_joblist *list, int *pagenum)
/* Print this page */
if (test_mode < TEST_MODE_NOPRINT ||
list->backend->flags & BACKEND_FLAG_DUMMYPRINT) {
- ret = list->backend->main_loop(list->ctx, list->entries[j]);
+ ret = list->backend->main_loop(list->ctx, list->entries[j], wait_on_return);
if (ret)
return ret;
}
diff --git a/backend_common.h b/backend_common.h
index 0ca7d64..f688698 100644
--- a/backend_common.h
+++ b/backend_common.h
@@ -289,7 +289,7 @@ struct dyesub_backend {
void (*cleanup_job)(const void *job);
void *(*combine_jobs)(const void *job1, const void *job2);
int (*job_polarity)(void *ctx);
- int (*main_loop)(void *ctx, const void *job);
+ int (*main_loop)(void *ctx, const void *job, int wait_on_return);
int (*query_serno)(struct dyesub_connection *conn, char *buf, int buf_len); /* Optional */
int (*query_markers)(void *ctx, struct marker **markers, int *count);
int (*query_stats)(void *ctx, struct printerstats *stats); /* Optional */
diff --git a/backend_dnpds40.c b/backend_dnpds40.c
index 71009c5..626e2d6 100644
--- a/backend_dnpds40.c
+++ b/backend_dnpds40.c
@@ -2103,14 +2103,14 @@ skip_checks:
DEBUG("job->dpi %u matte %d mcut %u cutter %d/%d, bufs %d spd %d\n",
job->dpi, job->matte, job->multicut, job->cutter, job->fullcut, job->buf_needed, job->printspeed);
- job->can_combine = job->can_rewind; /* Any rewindable size can be stacked */
+ job->common.can_combine = job->can_rewind; /* Any rewindable size can be stacked */
*vjob = job;
return CUPS_BACKEND_OK;
}
-static int dnpds40_main_loop(void *vctx, const void *vjob) {
+static int dnpds40_main_loop(void *vctx, const void *vjob, int wait_on_return) {
struct dnpds40_ctx *ctx = vctx;
int ret;
struct dnpds40_cmd cmd;
@@ -2384,7 +2384,7 @@ top:
if (ctx->partialmatte == 2)
ctx->partialmatte = 0;
- if (fast_return && !manual_copies) {
+ if (!wait_on_return && !manual_copies) {
INFO("Fast return mode enabled.\n");
} else if (!ctx->partialmatte) {
INFO("Waiting for job to complete...\n");
diff --git a/backend_hiti.c b/backend_hiti.c
index 6a3ee46..0652958 100644
--- a/backend_hiti.c
+++ b/backend_hiti.c
@@ -1793,7 +1793,7 @@ static int calc_offset(int val, int mid, int max, int step)
return val;
}
-static int hiti_main_loop(void *vctx, const void *vjob)
+static int hiti_main_loop(void *vctx, const void *vjob, int wait_for_return)
{
struct hiti_ctx *ctx = vctx;
@@ -1993,7 +1993,7 @@ resend_c:
return CUPS_BACKEND_FAILED;
}
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_kodak1400.c b/backend_kodak1400.c
index abc88ad..03f6023 100644
--- a/backend_kodak1400.c
+++ b/backend_kodak1400.c
@@ -412,7 +412,8 @@ static int kodak1400_read_parse(void *vctx, const void **vjob, int data_fd, int
static uint8_t idle_data[READBACK_LEN] = { 0xe4, 0x72, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };
-static int kodak1400_main_loop(void *vctx, const void *vjob) {
+static int kodak1400_main_loop(void *vctx, const void *vjob, int wait_for_return)
+{
struct kodak1400_ctx *ctx = vctx;
uint8_t rdbuf[READBACK_LEN], rdbuf2[READBACK_LEN];
@@ -421,6 +422,7 @@ static int kodak1400_main_loop(void *vctx, const void *vjob) {
int num, ret;
uint16_t temp16;
int copies;
+ (void)wait_for_return;
const struct kodak1400_printjob *job = vjob;
diff --git a/backend_kodak605.c b/backend_kodak605.c
index 6c9ab68..ce888a3 100644
--- a/backend_kodak605.c
+++ b/backend_kodak605.c
@@ -430,7 +430,7 @@ static int kodak605_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_OK;
}
-static int kodak605_main_loop(void *vctx, const void *vjob) {
+static int kodak605_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak605_ctx *ctx = vctx;
struct kodak605_status sts;
@@ -638,7 +638,7 @@ retry_print:
if (sts.hdr.status == STATUS_READY)
break;
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_kodak6800.c b/backend_kodak6800.c
index 8dfda5b..6fa354c 100644
--- a/backend_kodak6800.c
+++ b/backend_kodak6800.c
@@ -853,7 +853,7 @@ static int kodak6800_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
-static int kodak6800_main_loop(void *vctx, const void *vjob) {
+static int kodak6800_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak6800_ctx *ctx = vctx;
int num, ret;
@@ -980,7 +980,7 @@ static int kodak6800_main_loop(void *vctx, const void *vjob) {
if (ctx->sts.b2_jobid == hdr.jobid && ctx->sts.b2_complete == ctx->sts.b2_total)
break;
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_kodak8800.c b/backend_kodak8800.c
index b3f9311..d91b3c1 100644
--- a/backend_kodak8800.c
+++ b/backend_kodak8800.c
@@ -706,7 +706,7 @@ static int kodak8800_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_OK;
}
-static int kodak8800_main_loop(void *vctx, const void *vjob) {
+static int kodak8800_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct kodak8800_ctx *ctx = vctx;
int ret;
@@ -797,7 +797,7 @@ static int kodak8800_main_loop(void *vctx, const void *vjob) {
if (sts.sts[0] == STATE_IDLE) {
break;
}
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_magicard.c b/backend_magicard.c
index 0a45d67..5d81921 100644
--- a/backend_magicard.c
+++ b/backend_magicard.c
@@ -817,10 +817,11 @@ static int magicard_read_parse(void *vctx, const void **vjob, int data_fd, int c
return CUPS_BACKEND_OK;
}
-static int magicard_main_loop(void *vctx, const void *vjob) {
+static int magicard_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct magicard_ctx *ctx = vctx;
int ret;
int copies;
+ (void)wait_for_return;
const struct magicard_printjob *job = vjob;
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index b2ce5a0..ba59db0 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -337,7 +337,7 @@ STATIC_ASSERT(sizeof(struct mitsu70x_hdr) == 512);
STATIC_ASSERT(sizeof(struct mitsu70x_calinfo_resp) == 56);
static int mitsu70x_get_printerstatus(struct mitsu70x_ctx *ctx, struct mitsu70x_printerstatus_resp *resp);
-static int mitsu70x_main_loop(void *vctx, const void *vjob);
+static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return);
/* Error dumps, etc */
@@ -1725,7 +1725,7 @@ static int d70_library_callback(void *context, void *buffer, uint32_t len)
return ret;
}
-static int mitsu70x_main_loop(void *vctx, const void *vjob)
+static int mitsu70x_main_loop(void *vctx, const void *vjob, int wait_for_return)
{
struct mitsu70x_ctx *ctx = vctx;
struct mitsu70x_jobstatus jobstatus;
@@ -2159,7 +2159,7 @@ top:
}
/* See if we can return early, but wait until printing has started! */
- if (fast_return && copies <= 1 && /* Copies generated by backend! */
+ if (!wait_for_return && copies <= 1 && /* Copies generated by backend! */
jobstatus.job_status[0] == JOB_STATUS0_PRINT &&
jobstatus.job_status[1] > JOB_STATUS1_PRINT_MEDIALOAD)
{
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index 8e1564a..310ae58 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -202,7 +202,7 @@ struct mitsu9550_status2 {
uint8_t unkb[4]; /* 0a 00 00 01 */
} __attribute__((packed));
-static int mitsu9550_main_loop(void *vctx, const void *vjob);
+static int mitsu9550_main_loop(void *vctx, const void *vjob, int wait_for_return);
static const char *cp30_errors(uint16_t err)
{
@@ -732,7 +732,7 @@ hdr_done:
/* All further work is in main loop */
if (test_mode >= TEST_MODE_NOPRINT)
- mitsu9550_main_loop(ctx, job);
+ mitsu9550_main_loop(ctx, job, 1);
*vjob = job;
@@ -1004,7 +1004,7 @@ static int validate_media(int type, int media, int cols, int rows)
return CUPS_BACKEND_OK;
}
-static int mitsu9550_main_loop(void *vctx, const void *vjob) {
+static int mitsu9550_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsu9550_ctx *ctx = vctx;
struct mitsu9550_cmd cmd;
uint8_t rdbuf[READBACK_LEN];
@@ -1333,9 +1333,9 @@ top:
if (sts30->sts == CP30_STS_IDLE) /* If printer transitions to idle */
break;
- // XXX if (fast_return && copies_remaining == 0) break...
+ // XXX if (!wait_for_return && copies_remaining == 0) break...
- if (fast_return && sts30->sts != CP30_STS_IDLE) {
+ if (!wait_for_return && sts30->sts != CP30_STS_IDLE) {
INFO("Fast return mode enabled.\n");
break;
}
@@ -1351,12 +1351,12 @@ top:
if (!sts->sts1) /* If printer transitions to idle */
break;
- if (fast_return && !be16_to_cpu(sts->copies)) { /* No remaining prints */
+ if (!wait_for_return && !be16_to_cpu(sts->copies)) { /* No remaining prints */
INFO("Fast return mode enabled.\n");
break;
}
- if (fast_return && !sts->sts5) {
+ if (!wait_for_return && !sts->sts5) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_mitsud90.c b/backend_mitsud90.c
index 635548c..beb428d 100644
--- a/backend_mitsud90.c
+++ b/backend_mitsud90.c
@@ -719,7 +719,7 @@ static void mitsud90_cleanup_job(const void *vjob)
STATIC_ASSERT(sizeof(struct mitsud90_job_hdr) == 512);
STATIC_ASSERT(sizeof(struct mitsud90_plane_hdr) == 512);
-static int mitsud90_main_loop(void *vctx, const void *vjob);
+static int mitsud90_main_loop(void *vctx, const void *vjob, int wait_for_return);
static int mitsud90_panorama_splitjob(struct mitsud90_printjob *injob, struct mitsud90_printjob **newjobs)
{
@@ -1024,7 +1024,7 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
/* All further work is in main loop */
if (test_mode >= TEST_MODE_NOPRINT)
- mitsud90_main_loop(ctx, job);
+ mitsud90_main_loop(ctx, job, 1);
return CUPS_BACKEND_OK;
}
@@ -1054,7 +1054,7 @@ static int cpm1_fillmatte(struct mitsud90_printjob *job)
return CUPS_BACKEND_OK;
}
-static int mitsud90_main_loop(void *vctx, const void *vjob) {
+static int mitsud90_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsud90_ctx *ctx = vctx;
struct mitsud90_status_resp resp;
uint8_t last_status[2] = {0xff, 0xff};
@@ -1349,7 +1349,7 @@ top:
break;
}
- if (fast_return && copies <= 1) { /* Copies generated by backend? */
+ if (!wait_for_return && copies <= 1) { /* Copies generated by backend? */
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_mitsup95d.c b/backend_mitsup95d.c
index 1cbe362..ed6c4d4 100644
--- a/backend_mitsup95d.c
+++ b/backend_mitsup95d.c
@@ -348,7 +348,7 @@ top:
goto top;
}
-static int mitsup95d_main_loop(void *vctx, const void *vjob) {
+static int mitsup95d_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct mitsup95d_ctx *ctx = vctx;
uint8_t queryresp[QUERYRESP_SIZE_MAX];
int ret;
@@ -474,7 +474,7 @@ static int mitsup95d_main_loop(void *vctx, const void *vjob) {
break;
if (queryresp[7] > 0) {
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
@@ -487,7 +487,7 @@ static int mitsup95d_main_loop(void *vctx, const void *vjob) {
if (queryresp[6] == 0x30)
break;
if (queryresp[6] == 0x43 && queryresp[7] > 0) {
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
break;
}
diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c
index 498b873..6921195 100644
--- a/backend_shinkos1245.c
+++ b/backend_shinkos1245.c
@@ -1006,7 +1006,7 @@ static int shinkos1245_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
-static int shinkos1245_main_loop(void *vctx, const void *vjob) {
+static int shinkos1245_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos1245_ctx *ctx = vctx;
int i, num, last_state = -1, state = S_IDLE;
struct shinkos1245_resp_status status1, status2;
@@ -1168,7 +1168,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
}
diff --git a/backend_shinkos2145.c b/backend_shinkos2145.c
index 4aa57b3..cfc3927 100644
--- a/backend_shinkos2145.c
+++ b/backend_shinkos2145.c
@@ -923,7 +923,7 @@ static int shinkos2145_read_parse(void *vctx, const void **vjob, int data_fd, in
return CUPS_BACKEND_OK;
}
-static int shinkos2145_main_loop(void *vctx, const void *vjob) {
+static int shinkos2145_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos2145_ctx *ctx = vctx;
int ret, num;
@@ -1055,7 +1055,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY ||
diff --git a/backend_shinkos6145.c b/backend_shinkos6145.c
index 718cf7f..a5b53b0 100644
--- a/backend_shinkos6145.c
+++ b/backend_shinkos6145.c
@@ -1490,7 +1490,7 @@ done:
return newjob;
}
-static int shinkos6145_main_loop(void *vctx, const void *vjob) {
+static int shinkos6145_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos6145_ctx *ctx = vctx;
int ret, num;
@@ -1802,7 +1802,7 @@ top:
break;
}
case S_PRINTER_SENT_DATA:
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY) {
diff --git a/backend_shinkos6245.c b/backend_shinkos6245.c
index c97b8dd..3a8061a 100644
--- a/backend_shinkos6245.c
+++ b/backend_shinkos6245.c
@@ -1074,7 +1074,7 @@ static struct kodak8810_cutlist cutlist_8x4x3_d = {
.cut[5] = 3624,
};
-static int shinkos6245_main_loop(void *vctx, const void *vjob) {
+static int shinkos6245_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct shinkos6245_ctx *ctx = vctx;
int ret, num;
@@ -1322,7 +1322,7 @@ top:
state = S_PRINTER_SENT_DATA;
break;
case S_PRINTER_SENT_DATA:
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
state = S_FINISHED;
} else if (sts.hdr.status == STATUS_READY) {
diff --git a/backend_sonyupd.c b/backend_sonyupd.c
index 0cdbb98..ee7410f 100644
--- a/backend_sonyupd.c
+++ b/backend_sonyupd.c
@@ -512,7 +512,7 @@ static int upd_read_parse(void *vctx, const void **vjob, int data_fd, int copies
return CUPS_BACKEND_OK;
}
-static int upd_main_loop(void *vctx, const void *vjob) {
+static int upd_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct upd_ctx *ctx = vctx;
int i, ret;
int copies;
@@ -622,7 +622,7 @@ retry:
return CUPS_BACKEND_STOP;
}
- if (fast_return && ctx->stsbuf.printing != UPD_PRINTING_IDLE) {
+ if (!wait_for_return && ctx->stsbuf.printing != UPD_PRINTING_IDLE) {
INFO("Fast return mode enabled.\n");
} else {
goto retry;
diff --git a/backend_sonyupdneo.c b/backend_sonyupdneo.c
index 10a5fcd..c721133 100644
--- a/backend_sonyupdneo.c
+++ b/backend_sonyupdneo.c
@@ -534,7 +534,7 @@ static void updneo_dump_status(struct updneo_ctx *ctx, struct updneo_sts *sts)
}
}
-static int updneo_main_loop(void *vctx, const void *vjob) {
+static int updneo_main_loop(void *vctx, const void *vjob, int wait_for_return) {
struct updneo_ctx *ctx = vctx;
int ret;
int copies;
@@ -601,7 +601,7 @@ retry:
/* See if we're busy... */
if (ctx->sts.scprs != 0) {
- if (fast_return) {
+ if (!wait_for_return) {
INFO("Fast return mode enabled.\n");
} else {
goto retry;