From 0e39bf9ee47decbff007708c2018b75a5a4f093c Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Wed, 18 Feb 2015 21:04:33 -0500 Subject: [PATCH] s1245: Set the matte intensity when performing a matte print. --- backend_shinkos1245.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/backend_shinkos1245.c b/backend_shinkos1245.c index 80a7a5f..a5223c3 100644 --- a/backend_shinkos1245.c +++ b/backend_shinkos1245.c @@ -602,6 +602,32 @@ static int shinkos1245_canceljob(struct shinkos1245_ctx *ctx, } return 0; } +static int shinkos1245_set_matte(struct shinkos1245_ctx *ctx, + int intensity) +{ + struct shinkos1245_cmd_setmatte cmd; + struct shinkos1245_resp_status sts; + + int ret, num; + + shinkos1245_fill_hdr(&cmd.hdr); + cmd.cmd[0] = 0x21; + cmd.mode = MATTE_MODE_MATTE; + cmd.level = intensity; + + ret = shinkos1245_do_cmd(ctx, &cmd, sizeof(cmd), + &sts, sizeof(sts), &num); + if (ret < 0) { + ERROR("Failed to execute CANCELJOB command\n"); + return ret; + } + if (sts.code != CMD_CODE_OK) { + ERROR("Bad return code on CANCELJOB command\n"); + return -99; + } + + return 0; +} /* Structure dumps */ static char *shinkos1245_status_str(struct shinkos1245_resp_status *resp) @@ -1374,6 +1400,13 @@ top: case S_PRINTER_READY_CMD: { struct shinkos1245_cmd_print cmd; INFO("Initiating print job (internal id %d)\n", ctx->jobid); + + /* Set matte intensity */ + if (ctx->hdr.mattedepth != 0x7fffffff) { + i = shinkos1245_set_matte(ctx, ctx->hdr.mattedepth); + if (i < 0) + goto printer_error; + } shinkos1245_fill_hdr(&cmd.hdr); cmd.cmd[0] = 0x0a;