summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2017-12-07 11:46:46 -0500
committerSolomon Peachy <pizza@shaftnet.org>2017-12-07 11:53:01 -0500
commitad40d8893d887c4c83d8ca32d404add540e049a8 (patch)
treeab7fb2c06a7e0e6d4db3183ee80ca47c6e57c38a
parent9cde08b64a5d906c24926d6e7d6c5da1d88a1799 (diff)
downloadselphy_print-ad40d8893d887c4c83d8ca32d404add540e049a8.tar.gz
selphy_print-ad40d8893d887c4c83d8ca32d404add540e049a8.tar.bz2
selphy_print-ad40d8893d887c4c83d8ca32d404add540e049a8.zip
mitsu70x: Move job status query into its own command.
And add a wakeup command too.
-rw-r--r--README6
-rw-r--r--backend_mitsu70x.c63
2 files changed, 41 insertions, 28 deletions
diff --git a/README b/README
index 4285ad8..47d8fc1 100644
--- a/README
+++ b/README
@@ -646,15 +646,15 @@
Valid commands:
+ -j Query Job status
-k num Specify standby delay (1-10 minutes, 0 disables)
-s Query printer status (Only partially decoded)
+ -w Wake up printer
-x num Set USB iSerialNumber reporting (1 yes, 0 no) [1]
-X id Cancel print job 'id' [2]
[1] Printer will need to be power-cycled for this to take effect.
- [2] Job ID is the Internal Job ID (reported via status)
- To see which jobs are active/pending, see the output of the
- '-s' command.
+ [2] Job ID is the Internal Job ID (reported via job status query)
***************************************************************************
BACKEND=mitsu9550
diff --git a/backend_mitsu70x.c b/backend_mitsu70x.c
index d47fea0..9b6c992 100644
--- a/backend_mitsu70x.c
+++ b/backend_mitsu70x.c
@@ -1801,41 +1801,37 @@ static void mitsu70x_dump_printerstatus(struct mitsu70x_ctx *ctx,
}
}
-static int mitsu70x_query_status(struct mitsu70x_ctx *ctx)
+static int mitsu70x_query_jobs(struct mitsu70x_ctx *ctx)
{
- struct mitsu70x_printerstatus_resp resp;
#if 0
struct mitsu70x_jobs jobs;
- struct mitsu70x_jobstatus jobstatus;
#endif
-
+ struct mitsu70x_jobstatus jobstatus;
int ret;
-#if 0
-top:
ret = mitsu70x_get_jobstatus(ctx, &jobstatus, 0x0000);
if (ret)
- goto done;
-
- /* Make sure we're awake! */
- if (jobstatus.power) {
- ret = mitsu70x_wakeup(ctx);
- if (ret)
- return CUPS_BACKEND_FAILED;
-
- sleep(1);
- goto top;
- }
-#endif
-
- ret = mitsu70x_get_printerstatus(ctx, &resp);
- if (!ret)
- mitsu70x_dump_printerstatus(ctx, &resp);
+ return CUPS_BACKEND_FAILED;
-#if 0
INFO("JOB00 ID : %06u\n", jobstatus.jobid);
INFO("JOB00 status : %s\n", mitsu70x_jobstatuses(jobstatus.job_status));
+ INFO("Power Status: %s\n", jobstatus.power ? "Sleeping" : "Awake");
+ INFO("Mechanical Status: %s\n",
+ mitsu70x_mechastatus(jobstatus.mecha_status));
+ if (jobstatus.error_status[0]) {
+ INFO("%s/%s -> %s: %02x/%02x/%02x\n",
+ mitsu70x_errorclass(jobstatus.error_status),
+ mitsu70x_errors(jobstatus.error_status),
+ mitsu70x_errorrecovery(jobstatus.error_status),
+ jobstatus.error_status[0],
+ jobstatus.error_status[1],
+ jobstatus.error_status[2]);
+ }
+ // memory status
+ // temperature
+
+#if 0
ret = mitsu70x_get_jobs(ctx, &jobs);
if (!ret) {
int i;
@@ -1849,6 +1845,17 @@ top:
done:
#endif
+ return CUPS_BACKEND_OK;
+}
+
+static int mitsu70x_query_status(struct mitsu70x_ctx *ctx)
+{
+ struct mitsu70x_printerstatus_resp resp;
+ int ret;
+
+ ret = mitsu70x_get_printerstatus(ctx, &resp);
+ if (!ret)
+ mitsu70x_dump_printerstatus(ctx, &resp);
return ret;
}
@@ -1894,15 +1901,21 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
if (!ctx)
return -1;
- while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "sk:X:x:")) >= 0) {
+ while ((i = getopt(argc, argv, GETOPT_LIST_GLOBAL "jks:wX:x:")) >= 0) {
switch(i) {
GETOPT_PROCESS_GLOBAL
+ case 'j':
+ j = mitsu70x_query_jobs(ctx);
+ break;
case 'k':
j = mitsu70x_set_sleeptime(ctx, atoi(optarg));
break;
case 's':
j = mitsu70x_query_status(ctx);
break;
+ case 'w':
+ j = mitsu70x_wakeup(ctx);
+ break;
case 'x':
j = mitsu70x_set_iserial(ctx, atoi(optarg));
break;
@@ -1923,7 +1936,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.67",
+ .version = "0.68",
.uri_prefix = "mitsu70x",
.cmdline_usage = mitsu70x_cmdline,
.cmdline_arg = mitsu70x_cmdline_arg,