summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-02-28 19:21:40 -0500
committerSolomon Peachy <pizza@shaftnet.org>2018-02-28 19:23:46 -0500
commit6f4cf4160313386810ca40cba25a2cdd9812c131 (patch)
treecafef10dfc1252747a9a26e3b854ee4f62357069
parent2ddb2687a4a3318f2fdf7963b34005db6dc4b1f8 (diff)
downloadselphy_print-6f4cf4160313386810ca40cba25a2cdd9812c131.tar.gz
selphy_print-6f4cf4160313386810ca40cba25a2cdd9812c131.tar.bz2
selphy_print-6f4cf4160313386810ca40cba25a2cdd9812c131.zip
dnpds40: Taking a stab at detecting RX1HS media vs non-HS media.
(The non-HS media will *not* work in an HS printer, but HS media will work in a non-HS printer!)
-rw-r--r--backend_dnpds40.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/backend_dnpds40.c b/backend_dnpds40.c
index 3f67006..30d262c 100644
--- a/backend_dnpds40.c
+++ b/backend_dnpds40.c
@@ -102,6 +102,7 @@ struct dnpds40_ctx {
int mediaoffset;
int manual_copies;
int correct_count;
+ int needs_mlot;
uint32_t native_width;
int supports_6x9;
@@ -674,6 +675,7 @@ static void dnpds40_attach(void *vctx, struct libusb_device_handle *dev,
if (FW_VER_CHECK(1,20))
ctx->supports_3x5x2 = 1;
if (FW_VER_CHECK(2,00)) { /* AKA RX1HS */
+ ctx->needs_mlot = 1;
ctx->supports_mediaoffset = 1;
ctx->supports_iserial = 1;
}
@@ -1382,6 +1384,26 @@ static int dnpds40_main_loop(void *vctx, int copies) {
ATTR("marker-types=ribbonWax\n");
}
+ /* RX1HS requires HS media, but the only way to tell is that the
+ HS media reports a lot code, while the non-HS media does not. */
+ if (ctx->needs_mlot) {
+ /* Get Media Lot */
+ dnpds40_build_cmd(&cmd, "INFO", "MLOT", 0);
+
+ resp = dnpds40_resp_cmd(ctx, &cmd, &len);
+ if (!resp)
+ return CUPS_BACKEND_FAILED;
+
+ dnpds40_cleanup_string((char*)resp, len);
+
+ len = strlen((char*)resp);
+ free(resp);
+ if (!len) {
+ ERROR("Media does not report a valid lot number (non-HS media in RX1HS?)\n");
+ return CUPS_BACKEND_STOP;
+ }
+ }
+
top:
/* Query status */
@@ -2493,7 +2515,7 @@ static int dnpds40_cmdline_arg(void *vctx, int argc, char **argv)
/* Exported */
struct dyesub_backend dnpds40_backend = {
.name = "DNP DS40/DS80/DSRX1/DS620/DS820",
- .version = "0.95",
+ .version = "0.96",
.uri_prefix = "dnpds40",
.cmdline_usage = dnpds40_cmdline,
.cmdline_arg = dnpds40_cmdline_arg,