summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-09-21 15:57:15 -0400
committerSolomon Peachy <pizza@shaftnet.org>2018-09-21 15:59:22 -0400
commitf071aeb0c9e97c84776bb764da6eacd47f62c19a (patch)
tree1fa9d558aed4763ac218fbf6116fed4928cfe9b6
parent98c1534063f4b6443ce9aff4d1888c03df8582c7 (diff)
downloadselphy_print-f071aeb0c9e97c84776bb764da6eacd47f62c19a.tar.gz
selphy_print-f071aeb0c9e97c84776bb764da6eacd47f62c19a.tar.bz2
selphy_print-f071aeb0c9e97c84776bb764da6eacd47f62c19a.zip
canonselphy/neo: Pass media code into backend for tests.
Note that neither backend validates the media type until printing starts. Should change this..
-rw-r--r--backend_canonselphy.c2
-rw-r--r--backend_canonselphyneo.c6
-rw-r--r--regression.csv77
-rwxr-xr-xregression.pl7
4 files changed, 52 insertions, 40 deletions
diff --git a/backend_canonselphy.c b/backend_canonselphy.c
index dc95481..dd6accd 100644
--- a/backend_canonselphy.c
+++ b/backend_canonselphy.c
@@ -667,6 +667,8 @@ static int canonselphy_attach(void *vctx, struct libusb_device_handle *dev, int
ctx->marker.levelnow = -3; /* Unknown but OK */
ctx->marker.name = ctx->printer->pgcode_names? ctx->printer->pgcode_names(rdbuf, ctx->printer) : "Unknown";
} else {
+ // XXX handle MEDIA_CODE at some point.
+ // we don't do any error checking here.
ctx->marker.name = "Unknown";
}
diff --git a/backend_canonselphyneo.c b/backend_canonselphyneo.c
index 77ac06e..4f86df2 100644
--- a/backend_canonselphyneo.c
+++ b/backend_canonselphyneo.c
@@ -227,6 +227,8 @@ static int selphyneo_attach(void *vctx, struct libusb_device_handle *dev, int ty
} else {
rdback.data[2] = 0;
rdback.data[6] = 0x01;
+ if (getenv("MEDIA_CODE"))
+ rdback.data[6] = atoi(getenv("MEDIA_CODE"));
}
ctx->marker.color = "#00FFFF#FF00FF#FFFF00";
@@ -306,6 +308,8 @@ static int selphyneo_read_parse(void *vctx, const void **vjob, int data_fd, int
return CUPS_BACKEND_CANCEL;
}
+ // XXX Sanity check job against loaded media?
+
/* Allocate a buffer */
job->datalen = 0;
job->databuf = malloc(remain + sizeof(hdr));
@@ -535,7 +539,7 @@ static const char *canonselphyneo_prefixes[] = {
struct dyesub_backend canonselphyneo_backend = {
.name = "Canon SELPHY CP (new)",
- .version = "0.18",
+ .version = "0.19",
.uri_prefixes = canonselphyneo_prefixes,
.cmdline_usage = selphyneo_cmdline,
.cmdline_arg = selphyneo_cmdline_arg,
diff --git a/regression.csv b/regression.csv
index eacabb3..82f110a 100644
--- a/regression.csv
+++ b/regression.csv
@@ -2,8 +2,8 @@
#
# first, generic family entries
#
-canonselphy,0x04a9,0x3063,canon_cpxxx_p.raw,
-canonselphyneo,0x04a9,0x327a,canon_cp1200-p-cmy.raw,
+canonselphy,0x04a9,0x3063,canon_cpxxx_p.raw,0x11
+canonselphyneo,0x04a9,0x327a,canon_cp1200-p-cmy.raw,0x1
kodak68x0,0x040a,0x402b,kodak_68x0_4x6.raw,0xb
dnp_citizen,0x1343,0x0003,dnp_ds40_4x6.raw,300
mitsu9xxx,0x06d3,0x03a1,mitsu_9550_4x6.raw,0x2
@@ -13,46 +13,47 @@ magicard,0x0c1f,0x1800,magicard-8bpp.raw,
# 'canonselphy'
#
selphycp10,0x04a9,0x304a,canon_cp10_c.raw,
-selphycp100,0x04a9,0x3063,canon_cpxxx_p.raw,
-selphycp200,0x04a9,0x307c,canon_cpxxx_p.raw,
-selphycp220,0x04a9,0x30bd,canon_cpxxx_p.raw,
-selphycp300,0x04a9,0x307d,canon_cpxxx_p.raw,
-selphycp330,0x04a9,0x30be,canon_cpxxx_p.raw,
-selphycp400,0x04a9,0x30f6,canon_cpxxx_p.raw,
-selphycp500,0x04a9,0x30f5,canon_cpxxx_p.raw,
-selphycp510,0x04a9,0x3128,canon_cpxxx_p.raw,
-selphycp520,0x04a9,0x3172,canon_cpxxx_p.raw,
-selphycp530,0x04a9,0x31b1,canon_cpxxx_p.raw,
-selphycp600,0x04a9,0x310b,canon_cpxxx_p.raw,
-selphycp710,0x04a9,0x3127,canon_cpxxx_p.raw,
-selphycp720,0x04a9,0x3143,canon_cpxxx_p.raw,
-selphycp730,0x04a9,0x3142,canon_cpxxx_p.raw,
-selphycp740,0x04a9,0x3171,canon_cpxxx_p.raw,
-selphycp750,0x04a9,0x3170,canon_cpxxx_p.raw,
-selphycp760,0x04a9,0x31ab,canon_cpxxx_p.raw,
-selphycp770,0x04a9,0x31aa,canon_cpxxx_p.raw,
-selphycp780,0x04a9,0x31dd,canon_cpxxx_p.raw,
-selphycp800,0x04a9,0x3214,canon_cpxxx_p.raw,
-selphycp810,0x04a9,0x3256,canon_cpxxx_p.raw,
-selphycp790,0x04a9,0x31e7,canon_es40_cp790_p.raw,
-selphycp900,0x04a9,0x3255,canon_cp900_p.raw,
-selphyes1,0x04a9,0x3141,canon_es1_p.raw,
-selphyes2,0x04a9,0x3185,canon_es2_es20_l.raw,
-selphyes20,0x04a9,0x3186,canon_es2_es20_l.raw,
+selphycp100,0x04a9,0x3063,canon_cpxxx_p.raw,0x11
+selphycp200,0x04a9,0x307c,canon_cpxxx_p.raw,0x11
+selphycp220,0x04a9,0x30bd,canon_cpxxx_p.raw,0x11
+selphycp300,0x04a9,0x307d,canon_cpxxx_p.raw,0x11
+selphycp330,0x04a9,0x30be,canon_cpxxx_p.raw,0x11
+selphycp400,0x04a9,0x30f6,canon_cpxxx_p.raw,0x11
+selphycp500,0x04a9,0x30f5,canon_cpxxx_p.raw,0x11
+selphycp510,0x04a9,0x3128,canon_cpxxx_p.raw,0x11
+selphycp520,0x04a9,0x3172,canon_cpxxx_p.raw,0x11
+selphycp530,0x04a9,0x31b1,canon_cpxxx_p.raw,0x11
+selphycp600,0x04a9,0x310b,canon_cpxxx_p.raw,0x11
+selphycp710,0x04a9,0x3127,canon_cpxxx_p.raw,0x11
+selphycp720,0x04a9,0x3143,canon_cpxxx_p.raw,0x11
+selphycp730,0x04a9,0x3142,canon_cpxxx_p.raw,0x11
+selphycp740,0x04a9,0x3171,canon_cpxxx_p.raw,0x11
+selphycp750,0x04a9,0x3170,canon_cpxxx_p.raw,0x11
+selphycp760,0x04a9,0x31ab,canon_cpxxx_p.raw,0x11
+selphycp770,0x04a9,0x31aa,canon_cpxxx_p.raw,0x11
+selphycp780,0x04a9,0x31dd,canon_cpxxx_p.raw,0x11
+selphycp800,0x04a9,0x3214,canon_cpxxx_p.raw,0x11
+selphycp810,0x04a9,0x3256,canon_cpxxx_p.raw,0x11
+selphycp790,0x04a9,0x31e7,canon_es40_cp790_p.raw,0x00
+selphycp790,0x04a9,0x31e7,canon_es40_cp790_l.raw,0x11 # should be 0x10,0x01
+selphycp900,0x04a9,0x3255,canon_cp900_p.raw,0x11
+selphyes1,0x04a9,0x3141,canon_es1_p.raw,0x1
+selphyes2,0x04a9,0x3185,canon_es2_es20_l.raw,0x2
+selphyes20,0x04a9,0x3186,canon_es2_es20_l.raw,0x2
selphyes3,0x04a9,0x31af,canon_es3_es30_p.raw,
selphyes30,0x04a9,0x31b0,canon_es3_es30_p.raw,
-selphyes40,0x04a9,0x31ee,canon_es40_cp790_p.raw,
-selphyes40,0x04a9,0x31ee,canon_es40_cp790_l.raw,
+selphyes40,0x04a9,0x31ee,canon_es40_cp790_p.raw,0x11
+selphyes40,0x04a9,0x31ee,canon_es40_cp790_l.raw,0x22
#
# 'canonselphyneo'
#
-selphycp820,0x04a9,0x327b,canon_cp1200-p-ycbcr.raw,
-selphycp820,0x04a9,0x327b,canon_cp1200-p-cmy.raw,
-selphycp820,0x04a9,0x327b,canon_cp1200-c-ycbcr.raw,
-selphycp910,0x04a9,0x327a,canon_cp1200-p-cmy.raw,
-selphycp1000,0x04a9,0x32ae,canon_cp1200-p-cmy.raw,
-selphycp1200,0x04a9,0x32b1,canon_cp1200-p-cmy.raw,
-selphycp1300,0x04a9,0x32db,canon_cp1200-p-cmy.raw,
+selphycp820,0x04a9,0x327b,canon_cp1200-p-ycbcr.raw,0x1
+selphycp820,0x04a9,0x327b,canon_cp1200-p-cmy.raw,0x1
+selphycp820,0x04a9,0x327b,canon_cp1200-c-ycbcr.raw,0x3
+selphycp910,0x04a9,0x327a,canon_cp1200-p-cmy.raw,0x1
+selphycp1000,0x04a9,0x32ae,canon_cp1200-p-cmy.raw,0x1
+selphycp1200,0x04a9,0x32b1,canon_cp1200-p-cmy.raw,0x1
+selphycp1300,0x04a9,0x32db,canon_cp1200-p-cmy.raw,0x1
#
# 'kodak1400'
#
@@ -150,7 +151,7 @@ dnpds620,0x1452,0x8b01,dnp_ds40_4x6.raw,300
dnpds620,0x1452,0x8b01,dnp_ds40_4x6.raw,310
dnpds620,0x1452,0x8b01,dnp_ds40_6x8-600.raw,400
dnpds80,0x1343,0x0004,dnp_ds80_8x12.raw,510
-dnpds80dx,0x1343,0x0008,dnp_ds80_8x12.raw,510
+dnpds80dx,0x1343,0x0008,dnp_ds80_8x12.raw,510 # Duplex media 200
dnpds820,0x1452,0x9001,dnp_ds80_8x12.raw,510
dnprx1,0x1343,0x0005,dnp_ds40_4x6.raw,300
dnprx1,0x1343,0x0005,dnp_ds40_4x6.raw,310
diff --git a/regression.pl b/regression.pl
index b3016d9..be8ef8c 100755
--- a/regression.pl
+++ b/regression.pl
@@ -14,7 +14,12 @@ while (<STDIN>) {
$ENV{"BACKEND"} = $row[0];
$ENV{"EXTRA_VID"} = $row[1];
$ENV{"EXTRA_PID"} = $row[2];
- $ENV{"MEDIA_CODE"} = $row[4];
+
+ if (length($row[4])) {
+ $ENV{"MEDIA_CODE"} = $row[4];
+ } else {
+ unset($ENV{"MEDIA_CODE"});
+ }
print "***** $row[0] $row[1] $row[2] $row[3] $row[4]\n";