summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2017-12-16 08:30:13 -0500
committerSolomon Peachy <pizza@shaftnet.org>2017-12-16 08:30:42 -0500
commit800b9dd2388c26a0051f8a9fcc4ca25875c78c8a (patch)
tree3f2b326cb6212c772035c9a932ba33f01b70738f
parent8d85e5395a7122ce32cee457fabbc57932e43e24 (diff)
downloadselphy_print-800b9dd2388c26a0051f8a9fcc4ca25875c78c8a.tar.gz
selphy_print-800b9dd2388c26a0051f8a9fcc4ca25875c78c8a.tar.bz2
selphy_print-800b9dd2388c26a0051f8a9fcc4ca25875c78c8a.zip
mitsu70x: Fix logic error that prevented printer wakeups via a job.
-rw-r--r--backend_mitsu70x.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index 41685fe..869a336 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -1402,16 +1402,16 @@ static int mitsu70x_wakeup(struct mitsu70x_ctx *ctx, int wait)
uint8_t buf[512];
struct mitsu70x_jobstatus jobstatus;
- INFO("Waking up printer...\n");
top:
-
/* Query job status for jobid 0 (global) */
ret = mitsu70x_get_jobstatus(ctx, &jobstatus, 0x0000);
if (ret)
return CUPS_BACKEND_FAILED;
- /* Make sure we're awake */
- if (wait && jobstatus.power) {
+ /* Trigger a wakeup if necessary */
+ if (jobstatus.power) {
+ INFO("Waking up printer...\n");
+
memset(buf, 0, sizeof(buf));
buf[0] = 0x1b;
buf[1] = 0x45;
@@ -1422,8 +1422,10 @@ top:
buf, sizeof(buf))))
return CUPS_BACKEND_FAILED;
- sleep(1);
- goto top;
+ if (wait) {
+ sleep(1);
+ goto top;
+ }
}
@@ -1471,22 +1473,18 @@ static int mitsu70x_main_loop(void *vctx, int copies)
INFO("Waiting for printer idle...\n");
+ /* Ensure printer is awake */
+ ret = mitsu70x_wakeup(ctx, 1);
+ if (ret)
+ return CUPS_BACKEND_FAILED;
+
top:
+
/* Query job status for jobid 0 (global) */
ret = mitsu70x_get_jobstatus(ctx, &jobstatus, 0x0000);
if (ret)
return CUPS_BACKEND_FAILED;
- /* Make sure we're awake! */
- if (jobstatus.power) {
- ret = mitsu70x_wakeup(ctx, 0);
- if (ret)
- return CUPS_BACKEND_FAILED;
-
- sleep(1);
- goto top;
- }
-
/* Make sure temperature is sane */
if (jobstatus.temperature == TEMPERATURE_COOLING) {
INFO("Printer cooling down...\n");
@@ -1972,7 +1970,7 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
/* Exported */
struct dyesub_backend mitsu70x_backend = {
.name = "Mitsubishi CP-D70/D707/K60/D80",
- .version = "0.70",
+ .version = "0.71",
.uri_prefix = "mitsu70x",
.cmdline_usage = mitsu70x_cmdline,
.cmdline_arg = mitsu70x_cmdline_arg,