summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2014-05-27 08:45:14 +0200
committerDidier Raboud <odyx@debian.org>2014-05-27 08:45:14 +0200
commit58b4abe145a14a936e420a3ba5b7d0c6c56fa839 (patch)
tree04ab7e73f48fb25c9a927056402b680255d87687 /src
parent68062125a3214a6262bb1899b81f93abb35c8be9 (diff)
Imported Upstream version 5.2.10
Diffstat (limited to 'src')
-rw-r--r--src/cups/Makefile.am6
-rw-r--r--src/cups/Makefile.in4
-rw-r--r--src/cups/backend_common.c242
-rw-r--r--src/cups/blacklist11
-rw-r--r--src/cups/mitsu70x_print.c157
-rw-r--r--src/cups/selphy_print.c99
-rw-r--r--src/main/print-olympus.c252
-rw-r--r--src/testpattern/run-testpattern-2.in126
-rw-r--r--src/testpattern/testpattern.c61
-rw-r--r--src/xml/printers.xml4
10 files changed, 671 insertions, 291 deletions
diff --git a/src/cups/Makefile.am b/src/cups/Makefile.am
index 939f1a8..ec2e01d 100644
--- a/src/cups/Makefile.am
+++ b/src/cups/Makefile.am
@@ -1,4 +1,4 @@
-## $Id: Makefile.am,v 1.146 2014/02/19 12:26:43 speachy Exp $
+## $Id: Makefile.am,v 1.148 2014/03/27 22:37:09 speachy Exp $
## Copyright (C) 2000 Roger Leigh
##
## This program is free software; you can redistribute it and/or modify
@@ -93,8 +93,8 @@ endif
## See http://www.cups.org/documentation.php/doc-1.6/man-backend.html
if BUILD_LIBUSB_BACKENDS
install-exec-hook:
+ chmod 700 $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint
mv $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
- chmod 700 "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
endif
TESTS= test-ppds test-rastertogutenprint
@@ -118,7 +118,7 @@ if BUILD_LIBUSB_BACKENDS
backend_gutenprint_SOURCES = selphy_print.c kodak1400_print.c kodak6800_print.c kodak605_print.c shinko_s2145_print.c sony_updr150_print.c dnpds40_print.c mitsu70x_print.c backend_common.c backend_common.h
backend_gutenprint_LDADD = $(LIBUSB_LIBS)
-backend_gutenprint_CPPFLAGS = $(LIBUSB_CFLAGS) -DURI_PREFIX=\"gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb\"
+backend_gutenprint_CPPFLAGS = $(LIBUSB_CFLAGS) -DURI_PREFIX=\"gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb\" -DLIBUSB_PRE_1_0_10
endif
cups_genppd_@GUTENPRINT_RELEASE_VERSION@_SOURCES = genppd.c i18n.c i18n.h
diff --git a/src/cups/Makefile.in b/src/cups/Makefile.in
index 8af0f4a..25bfd1a 100644
--- a/src/cups/Makefile.in
+++ b/src/cups/Makefile.in
@@ -718,7 +718,7 @@ commandtoepson_SOURCES = commandtoepson.c
commandtoepson_LDADD = $(CUPS_LIBS)
@BUILD_LIBUSB_BACKENDS_TRUE@backend_gutenprint_SOURCES = selphy_print.c kodak1400_print.c kodak6800_print.c kodak605_print.c shinko_s2145_print.c sony_updr150_print.c dnpds40_print.c mitsu70x_print.c backend_common.c backend_common.h
@BUILD_LIBUSB_BACKENDS_TRUE@backend_gutenprint_LDADD = $(LIBUSB_LIBS)
-@BUILD_LIBUSB_BACKENDS_TRUE@backend_gutenprint_CPPFLAGS = $(LIBUSB_CFLAGS) -DURI_PREFIX=\"gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb\"
+@BUILD_LIBUSB_BACKENDS_TRUE@backend_gutenprint_CPPFLAGS = $(LIBUSB_CFLAGS) -DURI_PREFIX=\"gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb\" -DLIBUSB_PRE_1_0_10
cups_genppd_@GUTENPRINT_RELEASE_VERSION@_SOURCES = genppd.c i18n.c i18n.h
cups_genppd_@GUTENPRINT_RELEASE_VERSION@_CFLAGS = -DALL_LINGUAS='"$(ALL_LINGUAS)"' $(BUILD_SIMPLE_PPDS) $(TRANSLATE_PPDS)
cups_genppd_@GUTENPRINT_RELEASE_VERSION@_LDADD = $(CUPS_LIBS) $(GENPPD_LIBS) $(GUTENPRINT_LIBS) @LIBICONV@
@@ -1807,8 +1807,8 @@ $(top_builddir)/src/gutenprintui2/libgutenprintui2.la:
$(MAKE)
@BUILD_CUPS_TRUE@@BUILD_LIBUSB_BACKENDS_TRUE@install-exec-hook:
+@BUILD_CUPS_TRUE@@BUILD_LIBUSB_BACKENDS_TRUE@ chmod 700 $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint
@BUILD_CUPS_TRUE@@BUILD_LIBUSB_BACKENDS_TRUE@ mv $(DESTDIR)$(pkglibdir)/backend/backend_gutenprint "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
-@BUILD_CUPS_TRUE@@BUILD_LIBUSB_BACKENDS_TRUE@ chmod 700 "$(DESTDIR)$(pkglibdir)/backend/gutenprint$(GUTENPRINT_MAJOR_VERSION)$(GUTENPRINT_MINOR_VERSION)+usb"
@BUILD_LIBUSB_BACKENDS_TRUE@install-blacklist:
@BUILD_LIBUSB_BACKENDS_TRUE@ $(mkdir_p) $(DESTDIR)$(cupsdata_blacklistdir)
@BUILD_LIBUSB_BACKENDS_TRUE@ $(INSTALL_DATA) $(srcdir)/blacklist $(DESTDIR)$(cupsdata_blacklistdir)/net.sf.gimp-print.usb-quirks
diff --git a/src/cups/backend_common.c b/src/cups/backend_common.c
index 1139e12..73c6dba 100644
--- a/src/cups/backend_common.c
+++ b/src/cups/backend_common.c
@@ -27,7 +27,7 @@
#include "backend_common.h"
-#define BACKEND_VERSION "0.42G"
+#define BACKEND_VERSION "0.48G"
#ifndef URI_PREFIX
#error "Must Define URI_PREFIX"
#endif
@@ -91,6 +91,76 @@ done:
return buf;
}
+/* Used with the IEEE1284 deviceid string parsing */
+
+struct deviceid_dict {
+ char *key;
+ char *val;
+};
+
+#define MAX_DICT 32
+
+static int parse1284_data(const char *device_id, struct deviceid_dict* dict)
+{
+ char *ptr;
+ char key[256];
+ char val[256];
+ int num = 0;
+
+ //[whitespace]key[whitespace]:[whitespace]value[whitespace];
+ while (*device_id && num < MAX_DICT) {
+ /* Skip leading spaces */
+ if (*device_id == ' ')
+ device_id++;
+ if (!*device_id)
+ break;
+
+ /* Work out key */
+ for (ptr = key; *device_id && *device_id != ':'; device_id++)
+ *ptr++ = *device_id;
+ if (!*device_id)
+ break;
+ while (ptr > key && *(ptr-1) == ' ')
+ ptr--;
+ *ptr = 0;
+ device_id++;
+ if (!*device_id)
+ break;
+
+ /* Next up, value */
+ for (ptr = val; *device_id && *device_id != ';'; device_id++)
+ *ptr++ = *device_id;
+ if (!*device_id)
+ break;
+ while (ptr > val && *(ptr-1) == ' ')
+ ptr--;
+ *ptr = 0;
+ device_id++;
+
+ /* Add it to the dictionary */
+ dict[num].key = strdup(key);
+ dict[num].val = strdup(val);
+ num++;
+
+ if (!*device_id)
+ break;
+ }
+ return num;
+};
+
+static char *dict_find(const char *key, int dlen, struct deviceid_dict* dict)
+{
+ while(dlen) {
+ if (!strcmp(key, dict->key))
+ return dict->val;
+ dlen--;
+ dict++;
+ }
+ return NULL;
+}
+
+/* I/O functions */
+
int read_data(struct libusb_device_handle *dev, uint8_t endp,
uint8_t *buf, int buflen, int *readlen)
{
@@ -110,7 +180,7 @@ int read_data(struct libusb_device_handle *dev, uint8_t endp,
goto done;
}
- if (dyesub_debug) {
+ if (dyesub_debug > 1) {
int i;
DEBUG("<- ");
for (i = 0 ; i < *readlen; i++) {
@@ -138,10 +208,10 @@ int send_data(struct libusb_device_handle *dev, uint8_t endp,
buf, len2,
&num, 15000);
- if (dyesub_debug) {
+ if (dyesub_debug > 1) {
int i;
DEBUG("-> ");
- for (i = 0 ; i < len2; i++) {
+ for (i = 0 ; i < num; i++) {
DEBUG2("%02x ", *(buf+i));
}
DEBUG2("\n");
@@ -158,6 +228,7 @@ int send_data(struct libusb_device_handle *dev, uint8_t endp,
return 0;
}
+/* More stuff */
int terminate = 0;
static void sigterm_handler(int signum) {
@@ -237,9 +308,12 @@ static int print_scan_output(struct libusb_device *device,
struct dyesub_backend *backend)
{
struct libusb_device_handle *dev;
-
char buf[256];
- char *product = NULL, *serial = NULL, *manuf = NULL;
+ char *product = NULL, *serial = NULL, *manuf = NULL, *descr = NULL;
+
+ int dlen = 0;
+ struct deviceid_dict dict[MAX_DICT];
+ char *ieee_id;
if (libusb_open(device, &dev)) {
ERROR("Could not open device %04x:%04x (need to be root?)\n", desc->idVendor, desc->idProduct);
@@ -247,25 +321,77 @@ static int print_scan_output(struct libusb_device *device,
goto abort;
}
- /* Query detailed info */
- if (desc->iManufacturer) {
+ ieee_id = get_device_id(dev);
+
+ /* Get IEEE1284 info */
+ dlen = parse1284_data(ieee_id, dict);
+
+ /* Look up mfg string. */
+ if (manuf2 && strlen(manuf2)) {
+ manuf = url_encode(manuf2); /* Backend supplied */
+ } else if ((manuf = dict_find("MANUFACTURER", dlen, dict))) {
+ manuf = url_encode(manuf);
+ } else if ((manuf = dict_find("MFG", dlen, dict))) {
+ manuf = url_encode(manuf);
+ } else if ((manuf = dict_find("MFR", dlen, dict))) {
+ manuf = url_encode(manuf);
+ } else if (desc->iManufacturer) { /* Get from USB descriptor */
+ buf[0] = 0;
libusb_get_string_descriptor_ascii(dev, desc->iManufacturer, (unsigned char*)buf, STR_LEN_MAX);
sanitize_string(buf);
manuf = url_encode(buf);
}
- buf[0] = 0;
- if (desc->iProduct) {
- libusb_get_string_descriptor_ascii(dev, desc->iProduct, (unsigned char *)buf, STR_LEN_MAX);
+ if (!manuf || !strlen(manuf)) { /* Last-ditch */
+ if (manuf) free(manuf);
+ manuf = url_encode("Unknown");
+ }
+
+ /* Look up model number */
+ if ((product = dict_find("MODEL", dlen, dict))) {
+ product = url_encode(product);
+ } else if ((product = dict_find("MDL", dlen, dict))) {
+ product = url_encode(product);
+ } else if (desc->iProduct) { /* Get from USB descriptor */
+ buf[0] = 0;
+ libusb_get_string_descriptor_ascii(dev, desc->iProduct, (unsigned char*)buf, STR_LEN_MAX);
sanitize_string(buf);
product = url_encode(buf);
}
- buf[0] = 0;
- if (desc->iSerialNumber) {
+
+ if (!product || !strlen(product)) { /* Last-ditch */
+ if (!product) free(product);
+ product = url_encode("Unknown");
+ }
+
+ /* Look up description */
+ if ((descr = dict_find("DESCRIPTION", dlen, dict))) {
+ descr = strdup(descr);
+ } else if ((descr = dict_find("DES", dlen, dict))) {
+ descr = strdup(descr);
+ }
+ if (!descr || !strlen(descr)) { /* Last-ditch, generate */
+ char *product2 = url_decode(product);
+ char *manuf3 = url_decode(manuf);
+ descr = malloc(256);
+ sprintf(descr, "%s %s", manuf3, product2);
+ free(product2);
+ free(manuf3);
+ }
+
+ /* Look up serial number */
+ if ((serial = dict_find("SERIALNUMBER", dlen, dict))) {
+ serial = url_encode(serial);
+ } else if ((serial = dict_find("SN", dlen, dict))) {
+ serial = url_encode(serial);
+ } else if ((serial = dict_find("SER", dlen, dict))) {
+ serial = url_encode(serial);
+ } else if ((serial = dict_find("SERN", dlen, dict))) {
+ serial = url_encode(serial);
+ } else if (desc->iSerialNumber) { /* Get from USB descriptor */
libusb_get_string_descriptor_ascii(dev, desc->iSerialNumber, (unsigned char*)buf, STR_LEN_MAX);
sanitize_string(buf);
- } else if (backend->query_serno) {
- /* XXX this is ... a cut-n-paste hack */
-
+ serial = url_encode(buf);
+ } else if (backend->query_serno) { /* Get from backend hook */
int iface = 0;
struct libusb_config_descriptor *config;
@@ -274,6 +400,7 @@ static int print_scan_output(struct libusb_device *device,
/* If we fail to claim the printer, it's already in use
so we should just skip over it... */
+ buf[0] = 0;
if (!libusb_claim_interface(dev, iface)) {
int i;
uint8_t endp_up, endp_down;
@@ -291,15 +418,15 @@ static int print_scan_output(struct libusb_device *device,
backend->query_serno(dev, endp_up, endp_down, buf, STR_LEN_MAX);
libusb_release_interface(dev, iface);
}
+ serial = url_encode(buf);
}
-
- if (!strlen(buf)) {
+
+ if (!serial || !strlen(serial)) { /* Last-ditch */
+ if (serial) free(serial);
WARNING("**** THIS PRINTER DOES NOT REPORT A SERIAL NUMBER!\n");
- WARNING("**** If you intend to use multiple printers of this typpe, you\n");
+ WARNING("**** If you intend to use multiple printers of this type, you\n");
WARNING("**** must only plug one in at a time or unexpected behaivor will occur!\n");
serial = strdup("NONE_UNKNOWN");
- } else {
- serial = url_encode(buf);
}
if (dyesub_debug)
@@ -308,31 +435,23 @@ static int print_scan_output(struct libusb_device *device,
desc->idVendor, desc->idProduct, manuf, product, serial);
if (scan_only) {
- int j = 0, k = 0;
- char *ieee_id = get_device_id(dev);
- char *product2 = url_decode(product);
+ int k = 0;
/* URLify the manuf and model strings */
- if (strlen(manuf2))
- strncpy(buf, manuf2, sizeof(buf) - 2);
- else
- strncpy(buf, manuf, sizeof(buf) - 2);
+ strncpy(buf, manuf, sizeof(buf) - 2);
k = strlen(buf);
buf[k++] = '/';
buf[k] = 0;
- j = (manuf2 && strlen(manuf2)) ? strlen(manuf2) + 1 : 0;
- strncpy(buf + k, product + j, sizeof(buf)-k);
-
+ strncpy(buf + k, product, sizeof(buf)-k);
+
fprintf(stdout, "direct %s://%s?serial=%s&backend=%s \"%s\" \"%s\" \"%s\" \"\"\n",
prefix, buf, serial, backend->uri_prefix,
- product2, product2,
+ descr, descr,
ieee_id? ieee_id : "");
if (ieee_id)
free(ieee_id);
- if (product2)
- free(product2);
}
/* If a serial number was passed down, use it. */
@@ -344,10 +463,17 @@ static int print_scan_output(struct libusb_device *device,
if(serial) free(serial);
if(manuf) free(manuf);
if(product) free(product);
+ if(descr) free(descr);
libusb_close(dev);
abort:
+ /* Clean up the dictionary */
+ while (dlen--) {
+ free (dict[dlen].key);
+ free (dict[dlen].val);
+ }
+
return found;
}
@@ -381,7 +507,7 @@ static int find_and_enumerate(struct libusb_context *ctx,
struct libusb_device_descriptor desc;
int match = 0;
libusb_get_device_descriptor((*list)[i], &desc);
-
+
for (k = 0 ; backends[k] ; k++) {
if (backend && backend != backends[k])
continue;
@@ -464,7 +590,7 @@ for more details.\n\
You should have received a copy of the GNU General Public License\n\
along with this program; if not, write to the Free Software\n\
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\
-\n [http://www.gnu.org/licenses/gpl-2.0.html]\n\n";
+\n [http://www.gnu.org/licenses/gpl-3.0.html]\n\n";
fprintf(stderr, "%s", license);
}
@@ -473,6 +599,7 @@ static void print_help(char *argv0, struct dyesub_backend *backend)
{
struct libusb_context *ctx = NULL;
struct libusb_device **list = NULL;
+ int i;
char *ptr = strrchr(argv0, '/');
if (ptr)
@@ -490,9 +617,11 @@ static void print_help(char *argv0, struct dyesub_backend *backend)
DEBUG("\n");
DEBUG("Standalone Usage:\n");
DEBUG("\t%s\n", URI_PREFIX);
- DEBUG(" [ -D ] [ -G ] [ -S serialnum ] [ -B backendname ] \n");
+ DEBUG(" [ -D ] [ -G ]\n");
+ DEBUG(" [ -S serialnum ] [ -B backendname ] \n");
DEBUG(" [ -V extra_vid ] [ -P extra_pid ] [ -T extra_type ] \n");
- DEBUG(" [ [ backend_specific_args ] | [ - | infile ] ]\n");
+ DEBUG(" [ backend_specific_args ] \n");
+ DEBUG(" [ -d copies ] [ - | infile ] \n");
for (i = 0; ; i++) {
backend = backends[i];
if (!backend)
@@ -506,14 +635,18 @@ static void print_help(char *argv0, struct dyesub_backend *backend)
DEBUG("Standalone %s backend version %s\n",
backend->name, backend->version);
DEBUG("\t%s\n", backend->uri_prefix);
- DEBUG("\t[ -D ] [ -S serialnum ] \n");
+ DEBUG("\t[ -D ] [ -G ] [ -S serialnum ] \n");
DEBUG("\t[ -V extra_vid ] [ -P extra_pid ] [ -T extra_type ] \n");
- DEBUG("\t\t[ infile | - ]\n");
-
if (backend->cmdline_usage)
backend->cmdline_usage();
+ DEBUG("\t[ -d copies ] [ infile | - ]\n");
+ }
+
+ i = libusb_init(&ctx);
+ if (i) {
+ ERROR("Failed to initialize libusb (%d)\n", i);
+ exit(4); /* CUPS_BACKEND_STOP */
}
- libusb_init(&ctx);
find_and_enumerate(ctx, &list, backend, NULL, P_ANY, 1);
libusb_free_device_list(list, 1);
libusb_exit(ctx);
@@ -584,7 +717,7 @@ int main (int argc, char **argv)
/* Reset arg parsing */
optind = 1;
opterr = 0;
- while ((i = getopt(argc, argv, "B:DGhP:S:T:V:")) >= 0) {
+ while ((i = getopt(argc, argv, "B:dDGhP:S:T:V:")) >= 0) {
switch(i) {
case 'B':
backend = find_backend(optarg);
@@ -592,6 +725,9 @@ int main (int argc, char **argv)
fprintf(stderr, "ERROR: Unknown backend '%s'\n", optarg);
}
break;
+ case 'd':
+ copies = atoi(optarg);
+ break;
case 'D':
dyesub_debug++;
break;
@@ -627,13 +763,14 @@ int main (int argc, char **argv)
}
}
+#ifndef LIBUSB_PRE_1_0_10
if (dyesub_debug) {
const struct libusb_version *ver;
ver = libusb_get_version();
DEBUG(" ** running with libusb %d.%d.%d%s (%d)\n",
ver->major, ver->minor, ver->micro, (ver->rc? ver->rc : ""), ver->nano );
-
}
+#endif
/* Make sure a filename was specified */
if (!backend_cmd && (optind == argc || !argv[optind])) {
@@ -746,10 +883,17 @@ int main (int argc, char **argv)
}
/* Libusb setup */
- libusb_init(&ctx);
+ ret = libusb_init(&ctx);
+ if (ret) {
+ ERROR("Failed to initialize libusb (%d)\n", ret);
+ ret = 4;
+ goto done;
+ }
+
/* Enumerate devices */
found = find_and_enumerate(ctx, &list, backend, use_serno, printer_type, 0);
+#if 1
if (found == -1) {
ERROR("Printer open failure (No suitable printers found!)\n");
ret = 4; /* CUPS_BACKEND_STOP */
@@ -761,7 +905,7 @@ int main (int argc, char **argv)
ERROR("Printer open failure (Need to be root?) (%d)\n", ret);
goto done;
}
-
+
claimed = libusb_kernel_driver_active(dev, iface);
if (claimed) {
ret = libusb_detach_kernel_driver(dev, iface);
@@ -791,16 +935,16 @@ int main (int argc, char **argv)
endp_down = config->interface[0].altsetting[0].endpoint[i].bEndpointAddress;
}
}
-
+#endif
/* Attach backend to device */
backend->attach(backend_ctx, dev, endp_up, endp_down, jobid);
-
+
if (backend_cmd && !uri) {
if (backend->cmdline_arg(backend_ctx, argc, argv))
goto done_claimed;
if (!fname)
goto done_claimed;
- }
+ }
/* Time for the main processing loop */
INFO("Printing started (%d copies)\n", copies);
diff --git a/src/cups/blacklist b/src/cups/blacklist
index 02e3ae7..204a8bc 100644
--- a/src/cups/blacklist
+++ b/src/cups/blacklist
@@ -34,7 +34,7 @@
0x04a9 0x3128 blacklist
# Canon SELPHY CP520
-# ??? UNKNOWN
+0x04a9 0x3172 blacklist
# Canon SELPHY CP530
0x04a9 0x31b1 blacklist
@@ -75,15 +75,9 @@
# Canon SELPHY CP810
0x04a9 0x3256 blacklist
-# Canon SELPHY CP820
-# ??? UNKNOWN
-
# Canon SELPHY CP900
0x04a9 0x3255 blacklist
-# Canon SELPHY CP910
-# ??? UNKNOWN
-
# Canon SELPHY ES1
0x04a9 0x3141 blacklist
@@ -126,6 +120,9 @@
# Mitsubishi CP-D70/CP-D707
0x06d3 0x3b30 blacklist
+# Mitsubishi CP-K60DW-S
+0x06d3 0x3b31 blacklist
+
# DNP DS40 + Citizen CX
0x1343 0x0003 blacklist
diff --git a/src/cups/mitsu70x_print.c b/src/cups/mitsu70x_print.c
index bdfc427..72f5f2e 100644
--- a/src/cups/mitsu70x_print.c
+++ b/src/cups/mitsu70x_print.c
@@ -39,6 +39,7 @@
#define USB_VID_MITSU 0x06D3
#define USB_PID_MITSU_D70X 0x3B30
+#define USB_PID_MITSU_K60 0x3B31
/* Private data stucture */
struct mitsu70x_ctx {
@@ -75,17 +76,12 @@ static void mitsu70x_attach(void *vctx, struct libusb_device_handle *dev,
uint8_t endp_up, uint8_t endp_down, uint8_t jobid)
{
struct mitsu70x_ctx *ctx = vctx;
- struct libusb_device *device;
- struct libusb_device_descriptor desc;
UNUSED(jobid);
ctx->dev = dev;
ctx->endp_up = endp_up;
ctx->endp_down = endp_down;
-
- device = libusb_get_device(dev);
- libusb_get_device_descriptor(device, &desc);
}
@@ -158,13 +154,14 @@ static int mitsu70x_read_parse(void *vctx, int data_fd) {
remain = be16_to_cpu(mhdr->rows) * be16_to_cpu(mhdr->cols) * 2;
remain = (remain + 511) / 512 * 512; /* Round to nearest 512 bytes. */
remain *= 3; /* One for each plane */
+
if (mhdr->laminate) {
i = be16_to_cpu(mhdr->lamrows) * be16_to_cpu(mhdr->lamcols) * 2;
i = (i + 511) / 512 * 512; /* Round to nearest 512 bytes. */
remain += i;
}
- ctx->databuf = malloc(remain + sizeof(hdr));
+ ctx->databuf = malloc(sizeof(hdr) + remain);
if (!ctx->databuf) {
ERROR("Memory allocation failure!\n");
return 2;
@@ -175,9 +172,12 @@ static int mitsu70x_read_parse(void *vctx, int data_fd) {
/* Read in the spool data */
while(remain) {
- i = read(data_fd, ctx->databuf + ctx->datalen - remain, remain);
+ i = read(data_fd, ctx->databuf + ctx->datalen, remain);
+ if (i == 0)
+ return 1;
if (i < 0)
return i;
+ ctx->datalen += i;
remain -= i;
}
@@ -241,6 +241,15 @@ skip_query:
return 4;
}
+ if (dyesub_debug) {
+ unsigned int i;
+ DEBUG("Printer Status Dump: ");
+ for (i = 0 ; i < 26 ; i++) {
+ DEBUG2("%02x ", rdbuf[i]);
+ }
+ DEBUG2("\n");
+ }
+
if (memcmp(rdbuf, rdbuf2, READBACK_LEN)) {
memcpy(rdbuf2, rdbuf, READBACK_LEN);
} else if (state == last_state) {
@@ -313,6 +322,10 @@ skip_query:
struct mitsu70x_status_deck {
uint8_t unk[64];
+ // unk[0] 0x80 for NOT PRESENT, 0x00 for present.
+ // unk[7-8] 0x01ff or 0x0200? Changes; maybe status?
+ // unk[22-23] prints remaining, 16-bit BE
+
};
struct mitsu70x_status_resp {
@@ -366,8 +379,14 @@ static int mitsu70x_get_status(struct mitsu70x_ctx *ctx)
}
DEBUG2("\n");
}
- INFO("Prints remaining: Lower: %d Upper: %d\n",
- resp.lower.unk[23], resp.upper.unk[23]);
+ if (resp.upper.unk[0] & 0x80) { /* Not present */
+ INFO("Prints remaining: %d\n",
+ (resp.lower.unk[22] << 8) | resp.lower.unk[23]);
+ } else {
+ INFO("Prints remaining: Lower: %d Upper: %d\n",
+ (resp.lower.unk[22] << 8) | resp.lower.unk[23],
+ (resp.upper.unk[22] << 8) | resp.upper.unk[23]);
+ }
return 0;
}
@@ -406,8 +425,8 @@ static int mitsu70x_cmdline_arg(void *vctx, int argc, char **argv)
/* Exported */
struct dyesub_backend mitsu70x_backend = {
- .name = "Mitsubishi CP-D70/D707",
- .version = "0.12",
+ .name = "Mitsubishi CP-D70/D707/K60",
+ .version = "0.16",
.uri_prefix = "mitsu70x",
.cmdline_usage = mitsu70x_cmdline,
.cmdline_arg = mitsu70x_cmdline_arg,
@@ -417,7 +436,8 @@ struct dyesub_backend mitsu70x_backend = {
.read_parse = mitsu70x_read_parse,
.main_loop = mitsu70x_main_loop,
.devices = {
- { USB_VID_MITSU, USB_PID_MITSU_D70X, P_MITSU_D70X, "Mitsubishi"},
+ { USB_VID_MITSU, USB_PID_MITSU_D70X, P_MITSU_D70X, ""},
+ { USB_VID_MITSU, USB_PID_MITSU_K60, P_MITSU_D70X, ""},
{ 0, 0, 0, ""}
}
};
@@ -440,16 +460,19 @@ struct dyesub_backend mitsu70x_backend = {
1b 5a 54 01 00 00 00 00 00 00 00 00 00 00 00 00
XX XX YY YY QQ QQ ZZ ZZ SS 00 00 00 00 00 00 00
UU 00 00 00 00 00 00 00 00 TT 00 00 00 00 00 00
+ RR 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+
(padded by NULLs to a 512-byte boundary)
XX XX == columns
YY YY == rows
QQ QQ == lamination columns (equal to XX XX)
ZZ ZZ == lamination rows (YY YY + 12)
- SS == SuperFine mode (00 == off, 03 == on
- Lamination always turns this on!
+ SS == Print mode: 00 = Fine, 03 = SuperFine, 04 = UltraFine
+ (Matte requires Superfine or Ultrafine)
UU == 00 == Auto, 01 == Lower Deck, 02 == Upper Deck
TT == 00 with no lamination, 02 with.
+ RR == 00 (normal), 01 == (Double-cut 4x6), 05 == (double-cut 2x6)
[[ K60 ]] Header 2: (Header)
@@ -464,10 +487,11 @@ struct dyesub_backend mitsu70x_backend = {
YY YY == rows
QQ QQ == lamination columns (equal to XX XX)
ZZ ZZ == lamination rows (usually YY YY + 12)
- SS == UltraFine mode (00 == off, 04 == on.. forces 8x6 print?)
+ SS == Print mode: 00 = Fine, 04 = UltraFine
+ (Matte requires Ultrafine)
UU == 01 (Lower Deck)
TT == 00 with no lamination, 02 with.
- RR == 0x05 for double-cut 2x6, 0x00 for double-cut 4x6, otherwise 0x01
+ RR == 00 (normal), 01 == (Double-cut 4x6), 05 == (double-cut 2x6)
Data planes:
16-bit data, rounded up to 512-byte block (XX * YY * 2 bytes)
@@ -479,52 +503,83 @@ struct dyesub_backend mitsu70x_backend = {
********************************************************************
- Command format: (D70/D707)
+ Command format: (D707)
-> 1b 56 32 30
- <- [256 byte payload]
-
- e4 56 32 30 00 00 00 00 00 00 00 00 00 00 00 00 .V20............
- 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 ................
- 44 80 00 00 5f 00 00 3d 43 00 50 00 44 00 37 00 D..._..=C.P.D.7.
- 30 00 44 00 30 00 30 00 31 00 31 00 31 00 37 00 0.D.0.0.1.1.1.7.
- 33 31 36 54 31 33 21 a3 33 31 35 42 31 32 f5 e5 316T13!.315B12..
- 33 31 39 42 31 31 a3 fb 33 31 38 45 31 32 50 0d 319B11..318E12P.
- 33 31 37 41 32 32 a3 82 44 55 4d 4d 59 40 00 00 317A22..DUMMY@..
- 44 55 4d 4d 59 40 00 00 00 00 00 00 00 00 00 00 DUMMY@..........
-
- LOWER DECK
-
- 00 00 00 00 00 00 02 04 3f 00 00 04 96 00 00 00 ........?.......
- ff 0f 01 00 00 c8 NN NN 00 00 00 00 05 28 75 80 .......R.....(u.
- 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
- 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
-
- UPPER DECK
-
- 00 00 00 00 00 00 01 ee 3d 00 00 06 39 00 00 00 ........=...9...
- ff 02 00 00 01 90 NN NN 00 00 00 00 06 67 78 00 .............gx.
- 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
- 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00 ................
+ <- [256 byte payload]
- NN NN == Number of prints remaining on that deck.
- (None of the other fields are decoded yet)
+ CP-D707DW:
+
+ e4 56 32 30 00 00 00 00 00 00 00 00 00 00 00 00 .V20............
+ 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 00 ................
+ 44 80 00 00 5f 00 00 3d 43 00 50 00 44 00 37 00 D..._..=C.P.D.7.
+ 30 00 44 00 30 00 30 00 31 00 31 00 31 00 37 00 0.D.0.0.1.1.1.7.
+ 33 31 36 54 31 33 21 a3 33 31 35 42 31 32 f5 e5 316T13!.315B12..
+ 33 31 39 42 31 31 a3 fb 33 31 38 45 31 32 50 0d 319B11..318E12P.
+ 33 31 37 41 32 32 a3 82 44 55 4d 4d 59 40 00 00 317A22..DUMMY@..
+ 44 55 4d 4d 59 40 00 00 00 00 00 00 00 00 00 00 DUMMY@..........
+
+ LOWER DECK
+
+ 00 00 00 00 00 00 02 04 3f 00 00 04 96 00 00 00
+ ff 0f 01 00 00 c8 NN NN 00 00 00 00 05 28 75 80 NN NN: prints remaining
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+
+ UPPER DECK
+
+ 00 00 00 00 00 00 01 ee 3d 00 00 06 39 00 00 00
+ ff 02 00 00 01 90 NN NN 00 00 00 00 06 67 78 00 NN NN: prints remaining
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+
+ CP-K60DW-S:
+
+ e4 56 32 30 0f 00 00 00 00 00 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00 0a 80 00 00 00 00
+ 02 00 00 00 5e 00 04 87 43 00 50 00 4b 00 36 00
+ 30 00 44 00 30 00 32 00 33 00 32 00 30 00 36 00
+ 33 31 36 4b 33 31 d6 7a 33 31 35 41 33 31 ae 37
+ 33 31 39 41 37 31 6a 36 33 31 38 44 33 31 1e 4a
+ 33 31 37 42 32 31 f4 19 44 55 4d 4d 59 40 00 00
+ 44 55 4d 4d 59 40 00 00 00 00 00 00 00 00 00 00
+
+ LOWER DECK (K60)
+
+ 00 00 00 00 00 00 02 09 3f 00 00 00 05 00 00 01
+ 61 8f 00 00 01 40 NN NN 00 00 00 00 00 16 81 80 NN NN: prints remaining
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+
+ UPPER DECK (K60 -- No upper deck present)
+
+ 80 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 00
+ ff ff ff ff ff ff ff ff ff ff 00 00 00 00 80 00
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
+ 80 00 80 00 80 00 80 00 80 00 80 00 80 00 80 00
-> 1b 56 31 30 00 00
<- [26 byte payload]
- e4 56 31 30 00 00 00 XX YY ZZ 00 00 00 00 00 00
- 00 00 00 00 00 00 00 00 00 00
-
- XX/YY/ZZ are unkown. Observed values:
+ CP-D707DW:
+
+ e4 56 31 30 00 00 00 XX YY ZZ 00 00 00 00 00 00
+ 00 00 00 00 00 00 00 00 00 00
+
+ XX/YY/ZZ are unkown. Observed values:
+
+ 00 00 00
+ 40 80 a0
+ 80 80 a0
+
+ CP-K60DW-S: (only one readback observed so far)
- 40 80 a0
- 00 00 00
- 80 80 a0
+ e4 56 31 30 00 00 00 00 00 00 00 00 0f 00 00 00
+ 00 00 00 00 80 00 00 00 00 00
** ** ** ** ** **
- The windows drivers seem to send the id and status queries before
+ The windows drivers seem to send the id and status queries before
and in between each of the chunks sent to the printer. There doesn't
appear to be any particular intelligence in the protocol, but it didn't
work when the raw dump was submitted as-is.
diff --git a/src/cups/selphy_print.c b/src/cups/selphy_print.c
index a15c572..7247e51 100644
--- a/src/cups/selphy_print.c
+++ b/src/cups/selphy_print.c
@@ -48,7 +48,7 @@
#define USB_PID_CANON_CP400 0x30F6
#define USB_PID_CANON_CP500 0x30F5
#define USB_PID_CANON_CP510 0x3128
-#define USB_PID_CANON_CP520 520 // XXX 316f? 3172? (related to cp740/cp750)
+#define USB_PID_CANON_CP520 0x3172
#define USB_PID_CANON_CP530 0x31b1
#define USB_PID_CANON_CP600 0x310B
#define USB_PID_CANON_CP710 0x3127
@@ -62,9 +62,7 @@
#define USB_PID_CANON_CP790 0x31E7
#define USB_PID_CANON_CP800 0x3214
#define USB_PID_CANON_CP810 0x3256
-#define USB_PID_CANON_CP820 820 // XXX
#define USB_PID_CANON_CP900 0x3255
-#define USB_PID_CANON_CP910 910 // XXX
#define USB_PID_CANON_ES1 0x3141
#define USB_PID_CANON_ES2 0x3185
#define USB_PID_CANON_ES20 0x3186
@@ -926,7 +924,7 @@ top:
struct dyesub_backend canonselphy_backend = {
.name = "Canon SELPHY CP/ES",
- .version = "0.81",
+ .version = "0.82.2G",
.uri_prefix = "canonselphy",
.init = canonselphy_init,
.attach = canonselphy_attach,
@@ -935,38 +933,36 @@ struct dyesub_backend canonselphy_backend = {
.read_parse = canonselphy_read_parse,
.main_loop = canonselphy_main_loop,
.devices = {
- { USB_VID_CANON, USB_PID_CANON_CP10, P_CP10, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP100, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP200, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP220, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP300, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP330, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP400, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP500, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP510, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP520, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP530, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP600, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP710, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP720, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP730, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP740, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP750, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP760, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP770, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP780, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP790, P_ES40_CP790, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP800, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP810, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP820, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP900, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_CP910, P_CP_XXX, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES1, P_ES1, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES2, P_ES2_20, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES20, P_ES2_20, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES3, P_ES3_30, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES30, P_ES3_30, "Canon"},
- { USB_VID_CANON, USB_PID_CANON_ES40, P_ES40_CP790, "Canon"},
+ { USB_VID_CANON, USB_PID_CANON_CP10, P_CP10, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP100, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP200, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP220, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP300, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP330, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP400, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP500, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP510, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP520, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP530, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP600, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP710, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP720, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP730, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP740, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP750, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP760, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP770, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP780, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP790, P_ES40_CP790, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP800, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP810, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_CP900, P_CP_XXX, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES1, P_ES1, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES2, P_ES2_20, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES20, P_ES2_20, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES3, P_ES3_30, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES30, P_ES3_30, ""},
+ { USB_VID_CANON, USB_PID_CANON_ES40, P_ES40_CP790, ""},
{ 0, 0, 0, ""}
}
};
@@ -1281,5 +1277,36 @@ struct dyesub_backend canonselphy_backend = {
0x41 if the 'Wide' paper tray is loaded with a 'P' ribbon. A '0' is used
to signify nothing being loaded.
+ ***************************************************************************
+ Selphy CP820/CP910:
+
+ Radically different spool file format! 300dpi, same print sizes, but also
+ adding a 50x50mm sticker and 22x17.3mm ministickers, though I think the
+ driver treats all of those as 'C' sizes for printing purposes.
+
+ 32-byte header:
+
+ 0f 00 00 40 00 00 00 00 00 00 00 00 00 00 01 00
+ 01 00 ?? 00 00 00 00 00 XX 04 00 00 WW ZZ 00 00
+
+ ?? == 50 (P)
+ == 4c (L)
+ == 43 (C)
+
+ XX == e0 (P)
+ 80 (L)
+ 40 (C)
+
+ WW == 50 (P)
+ c0 (L)
+ 9c (C)
+
+ ZZ == 07 (P)
+ 05 (L)
+ 02 (C)
+
+ P == 7008800 == 2336256 * 3 + 32 (4.884% larger than CP)
+ L == 5087264 == 1695744 * 3 + 32 (5.878% larger than CP)
+ C == 2180384 == 726784 * 3 + 32 (3.991% larger than CP)
*/
diff --git a/src/main/print-olympus.c b/src/main/print-olympus.c
index 7854f51..42c4897 100644
--- a/src/main/print-olympus.c
+++ b/src/main/print-olympus.c
@@ -1,5 +1,5 @@
/*
- * "$Id: print-olympus.c,v 1.157 2014/03/07 14:03:36 speachy Exp $"
+ * "$Id: print-olympus.c,v 1.165 2014/05/07 11:16:56 speachy Exp $"
*
* Print plug-in DyeSub driver (formerly Olympus driver) for the GIMP.
*
@@ -1015,6 +1015,68 @@ static void cp900_printer_end_func(stp_vars_t *v)
dyesub_nputc(v, 0x0, 4);
}
+/* Canon CP820/CP910 */
+static const dyesub_pagesize_t cp910_page[] =
+{
+ { "Postcard", "Postcard 100x148mm", PT(1248,300)+1, PT(1872,300)+1, 13, 13, 16, 19, DYESUB_PORTRAIT},
+ { "w253h337", "CP_L 89x119mm", PT(1104,300)+1, PT(1536,300)+1, 13, 13, 15, 15, DYESUB_PORTRAIT},
+ { "w155h244", "Card 54x86mm", PT(1088,300)+1, PT(668,300)+1, 13, 13, 15, 15, DYESUB_LANDSCAPE},
+ { "Custom", NULL, PT(1248,300)+1, PT(1872,300)+1, 13, 13, 16, 19, DYESUB_PORTRAIT},
+};
+
+LIST(dyesub_pagesize_list_t, cp910_page_list, dyesub_pagesize_t, cp910_page);
+
+static const dyesub_printsize_t cp910_printsize[] =
+{
+ { "300x300", "Postcard", 1248, 1872},
+ { "300x300", "w253h337", 1104, 1536},
+ { "300x300", "w155h244", 668, 1088},
+ { "300x300", "Custom", 1248, 1872},
+};
+
+LIST(dyesub_printsize_list_t, cp910_printsize_list, dyesub_printsize_t, cp910_printsize);
+
+static void cp910_printer_init_func(stp_vars_t *v)
+{
+ char pg;
+
+ stp_zfwrite("\x0f\x00\x00\x40\x00\x00\x00\x00", 1, 8, v);
+ stp_zfwrite("\x00\x00\x00\x00\x00\x00\x01\x00", 1, 8, v);
+ stp_putc(0x01, v);
+ stp_putc(0x00, v);
+
+ pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x50 :
+ (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x4c :
+ (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x43 :
+ 0x50 )));
+ stp_putc(pg, v);
+
+ dyesub_nputc(v, '\0', 5);
+
+ pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0xe0 :
+ (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x80 :
+ (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x40 :
+ 0xe0 )));
+ stp_putc(pg, v);
+
+ stp_putc(0x04, v);
+ dyesub_nputc(v, '\0', 2);
+
+ pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x50 :
+ (strcmp(privdata.pagesize, "w253h337") == 0 ? 0xc0 :
+ (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x9c :
+ 0x50 )));
+ stp_putc(pg, v);
+
+ pg = (strcmp(privdata.pagesize, "Postcard") == 0 ? 0x07 :
+ (strcmp(privdata.pagesize, "w253h337") == 0 ? 0x05 :
+ (strcmp(privdata.pagesize, "w155h244") == 0 ? 0x02 :
+ 0x07 )));
+ stp_putc(pg, v);
+
+ dyesub_nputc(v, '\0', 2);
+}
+
/* Sony DPP-EX5, DPP-EX7 */
static const dyesub_resolution_t res_403dpi[] =
{
@@ -1578,6 +1640,30 @@ static void kodak_6850_printer_init(stp_vars_t *v)
}
/* Kodak 605 */
+static const dyesub_pagesize_t kodak_605_page[] =
+{
+ { "w288h432", "4x6", PT(1240,300)+1, PT(1844,300)+1, 0, 0, 0, 0,
+ DYESUB_LANDSCAPE}, /* 4x6 */
+ { "w360h504", "5x7", PT(1500,300)+1, PT(2100,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT}, /* 5x7 */
+ { "w432h576", "6x8", PT(1844,300)+1, PT(2434,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT}, /* 6x8 */
+ { "Custom", NULL, PT(1240,300)+1, PT(1844,300)+1, 0, 0, 0, 0,
+ DYESUB_LANDSCAPE}, /* 4x6 */
+};
+
+LIST(dyesub_pagesize_list_t, kodak_605_page_list, dyesub_pagesize_t, kodak_605_page);
+
+static const dyesub_printsize_t kodak_605_printsize[] =
+{
+ { "300x300", "w288h432", 1240, 1844},
+ { "300x300", "w360h504", 1500, 2100},
+ { "300x300", "w432h576", 1844, 2434},
+ { "300x300", "Custom", 1240, 1844},
+};
+
+LIST(dyesub_printsize_list_t, kodak_605_printsize_list, dyesub_printsize_t, kodak_605_printsize);
+
static void kodak_605_printer_init(stp_vars_t *v)
{
stp_zfwrite("\x01\x40\x0a\x00\x01", 1, 5, v);
@@ -1585,7 +1671,17 @@ static void kodak_605_printer_init(stp_vars_t *v)
stp_putc(0x00, v);
stp_put16_le(privdata.w_size, v);
stp_put16_le(privdata.h_size, v);
- stp_putc(privdata.h_size == 1240 ? 0x01 : 0x03, v);
+ if (privdata.h_size == 1240)
+ stp_putc(0x01, v);
+ else if (privdata.h_size == 2100)
+ stp_putc(0x02, v);
+ else if (privdata.h_size == 2434)
+ stp_putc(0x03, v);
+ else if (privdata.h_size == 2490)
+ stp_putc(0x04, v);
+ else
+ stp_putc(0x01, v);
+
stp_zfwrite((privdata.laminate->seq).data, 1,
(privdata.laminate->seq).bytes, v);
stp_putc(0x00, v);
@@ -2451,12 +2547,24 @@ static const dyesub_pagesize_t mitsu_cpd70x_page[] =
DYESUB_LANDSCAPE},
{ "w288h432", "4x6", PT(1228,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
DYESUB_LANDSCAPE},
+#ifdef DNPX2
+ { "2x6_x2", "4x6*2", PT(1228,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
+ DYESUB_LANDSCAPE},
+#endif
{ "w360h504", "5x7", PT(1572,300)+1, PT(2128,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
+ { "w432h432", "6x6", PT(1820,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
+ DYESUB_LANDSCAPE},
{ "w432h576", "6x8", PT(1864,300)+1, PT(2422,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
+ { "w432h612", "6x8.5", PT(1864,300)+1, PT(2564,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT},
{ "w432h648", "6x9", PT(1864,300)+1, PT(2730,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
+#ifdef DNPX2
+ { "4x6_x2", "4x6*2", PT(1864,300)+1, PT(2730,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT},
+#endif
{ "Custom", NULL, PT(1228,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
DYESUB_LANDSCAPE},
};
@@ -2467,9 +2575,17 @@ static const dyesub_printsize_t mitsu_cpd70x_printsize[] =
{
{ "300x300", "B7", 1076, 1568},
{ "300x300", "w288h432", 1228, 1864},
+#ifdef DNPX2
+ { "300x300", "2x6_x2", 1228, 1864},
+#endif
{ "300x300", "w360h504", 1572, 2128},
+ { "300x300", "w432h432", 1820, 1864},
{ "300x300", "w432h576", 1864, 2422},
+ { "300x300", "w432h612", 1864, 2564},
{ "300x300", "w432h648", 1864, 2730},
+#ifdef DNPX2
+ { "300x300", "4x6_x2", 1864, 2730},
+#endif
{ "300x300", "Custom", 1220, 1868},
};
@@ -2477,13 +2593,13 @@ LIST(dyesub_printsize_list_t, mitsu_cpd70x_printsize_list, dyesub_printsize_t, m
static const laminate_t mitsu_cpd70x_laminate[] =
{
+ {"Glossy", N_("Glossy"), {1, "\x00"}},
{"Matte", N_("Matte"), {1, "\x02"}},
- {"None", N_("None"), {1, "\x00"}},
};
LIST(laminate_list_t, mitsu_cpd70x_laminate_list, laminate_t, mitsu_cpd70x_laminate);
-static void mitsu_cpd70x_printer_init(stp_vars_t *v)
+static void mitsu_cpd70k60_printer_init(stp_vars_t *v, int is_k60)
{
/* Printer init */
stp_putc(0x1b, v);
@@ -2496,40 +2612,69 @@ static void mitsu_cpd70x_printer_init(stp_vars_t *v)
stp_putc(0x1b, v);
stp_putc(0x5a, v);
stp_putc(0x54, v);
- stp_putc(0x01, v);
+ if (is_k60) {
+ stp_putc(0x0, v);
+ } else {
+ stp_putc(0x01, v);
+ }
dyesub_nputc(v, 0x00, 12);
stp_put16_be(privdata.w_size, v);
stp_put16_be(privdata.h_size, v);
- if (*((const char*)((privdata.laminate->seq).data)) == 0x01) {
+ if (*((const char*)((privdata.laminate->seq).data)) != 0x00) {
/* Laminate a slightly larger boundary */
stp_put16_be(privdata.w_size, v);
stp_put16_be(privdata.h_size + 12, v);
- stp_putc(0x03, v); /* Trigger Superfine */
+ if (is_k60) {
+ stp_putc(0x04, v); /* Matte Lamination forces UltraFine */
+ } else {
+ stp_putc(0x03, v); /* Matte Lamination forces Superfine (or UltraFine) */
+ }
} else {
dyesub_nputc(v, 0x00, 4); /* Ie no Lamination */
- stp_putc(0x00, v);
+ stp_putc(0x00, v); /* Fine mode */
}
dyesub_nputc(v, 0x00, 7);
- stp_putc(0x00, v); /* Auto deck selection, or 0x01 for Lower, 0x02 for Upper */
+ if (is_k60) {
+ stp_putc(0x01, v); /* K60 has a single "lower" deck */
+ } else {
+ stp_putc(0x00, v); /* Auto deck selection, or 0x01 for Lower, 0x02 for Upper */
+ }
dyesub_nputc(v, 0x00, 8);
stp_zfwrite((privdata.laminate->seq).data, 1,
(privdata.laminate->seq).bytes, v); /* Lamination mode */
dyesub_nputc(v, 0x00, 6);
- dyesub_nputc(v, 0x00, 464); /* Pad to 512-byte block */
+ /* Multi-cut control */
+ if (strcmp(privdata.pagesize,"4x6_x2") == 0) {
+ stp_putc(0x01, v);
+ } else if (strcmp(privdata.pagesize,"B7_x2") == 0) {
+ stp_putc(0x01, v);
+ } else if (strcmp(privdata.pagesize,"2x6_x2") == 0) {
+ stp_putc(0x05, v);
+ } else {
+ stp_putc(0x00, v);
+ }
+ dyesub_nputc(v, 0x00, 15);
+
+ dyesub_nputc(v, 0x00, 448); /* Pad to 512-byte block */
+}
+
+static void mitsu_cpd70x_printer_init(stp_vars_t *v)
+{
+ mitsu_cpd70k60_printer_init(v, 0);
}
static void mitsu_cpd70x_printer_end(stp_vars_t *v)
{
- /* If lamination is enabled, generate a lamination plane */
- if (*((const char*)((privdata.laminate->seq).data)) == 0x01) {
+ /* If Matte lamination is enabled, generate a lamination plane */
+ if (*((const char*)((privdata.laminate->seq).data)) != 0x00) {
/* The Windows drivers generate a lamination pattern consisting of
four values: 0xab58, 0x286a, 0x6c22 */
-
+
int r, c;
unsigned long seed = 1;
@@ -2563,12 +2708,24 @@ static const dyesub_pagesize_t mitsu_cpk60_page[] =
DYESUB_LANDSCAPE},
{ "w288h432", "4x6", PT(1218,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
DYESUB_LANDSCAPE},
+#ifdef DNPX2
+ { "2x6_x2", "2x6*2", PT(1218,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
+ DYESUB_LANDSCAPE},
+#endif
{ "w360h504", "5x7", PT(1568,300)+1, PT(2128,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
+#ifdef DNPX2
+ { "B7_x2", "3.5x5*2", PT(1568,300)+1, PT(2190,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT},
+#endif
{ "w432h432", "6x6", PT(1864,300)+1, PT(1820,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
{ "w432h576", "6x8", PT(1864,300)+1, PT(2422,300)+1, 0, 0, 0, 0,
DYESUB_PORTRAIT},
+#ifdef DNPX2
+ { "4x6_x2", "4x6*2", PT(1864,300)+1, PT(2454,300)+1, 0, 0, 0, 0,
+ DYESUB_PORTRAIT},
+#endif
{ "Custom", NULL, PT(1218,300)+1, PT(1864,300)+1, 0, 0, 0, 0,
DYESUB_LANDSCAPE},
};
@@ -2579,9 +2736,18 @@ static const dyesub_printsize_t mitsu_cpk60_printsize[] =
{
{ "300x300", "B7", 1076, 1568},
{ "300x300", "w288h432", 1218, 1864},
+#ifdef DNPX2
+ { "300x300", "2x6_x2", 1218, 1864},
+#endif
{ "300x300", "w360h504", 1568, 2128},
+#ifdef DNPX2
+ { "B7_x2", "3.5x5*24", 1568, 2190},
+#endif
{ "300x300", "w432h432", 1864, 1820},
{ "300x300", "w432h576", 1864, 2422},
+#ifdef DNPX2
+ { "300x300", "4x6_x2", 1864, 2454},
+#endif
{ "300x300", "Custom", 1218, 1864},
};
@@ -2589,47 +2755,9 @@ LIST(dyesub_printsize_list_t, mitsu_cpk60_printsize_list, dyesub_printsize_t, mi
static void mitsu_cpk60_printer_init(stp_vars_t *v)
{
- /* Printer init */
- stp_putc(0x1b, v);
- stp_putc(0x45, v);
- stp_putc(0x57, v);
- stp_putc(0x55, v);
- dyesub_nputc(v, 0x00, 508);
-
- /* Each copy gets this.. */
- stp_putc(0x1b, v);
- stp_putc(0x5a, v);
- stp_putc(0x54, v);
- stp_putc(0x00, v);
- dyesub_nputc(v, 0x00, 12);
-
- stp_put16_be(privdata.w_size, v);
- stp_put16_be(privdata.h_size, v);
- if (*((const char*)((privdata.laminate->seq).data)) == 0x02) {
- /* Laminate a slightly larger boundary */
- stp_put16_be(privdata.w_size, v);
- stp_put16_be(privdata.h_size + 12, v); /* XXX this isn't always true.. */
- } else {
- dyesub_nputc(v, 0x00, 4); /* Ie no Lamination */
- }
- stp_putc(0x00, v); /* Disable UltraFine for now (0x04 enables it) */
- dyesub_nputc(v, 0x00, 7);
-
- stp_putc(0x01, v); /* K60 has a single "lower" deck */
- dyesub_nputc(v, 0x00, 8);
-
- stp_zfwrite((privdata.laminate->seq).data, 1,
- (privdata.laminate->seq).bytes, v); /* Lamination mode */
- dyesub_nputc(v, 0x00, 6);
-
- stp_putc(0x01, v); /* Unknown */
- dyesub_nputc(v, 0x00, 15);
-
- dyesub_nputc(v, 0x00, 448); /* Pad to 512-byte block */
+ mitsu_cpd70k60_printer_init(v, 1);
}
-
-
/* Shinko CHC-S9045 (experimental) */
static const dyesub_pagesize_t shinko_chcs9045_page[] =
{
@@ -3420,6 +3548,22 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
cpx00_adj_cyan, cpx00_adj_magenta, cpx00_adj_yellow,
NULL, NULL,
},
+ { /* Canon CP820, CP910 */
+ 1011,
+ &bgr_ink_list,
+ &res_300dpi_list,
+ &cp910_page_list,
+ &cp910_printsize_list,
+ SHRT_MAX,
+ DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT
+ | DYESUB_FEATURE_BORDERLESS | DYESUB_FEATURE_WHITE_BORDER
+ | DYESUB_FEATURE_PLANE_INTERLACE,
+ &cp910_printer_init_func, NULL,
+ NULL, NULL,
+ NULL, NULL,
+ NULL, NULL, NULL, /* Unknown color correction! */
+ NULL, NULL,
+ },
{ /* Sony UP-DP10 */
2000,
&cmy_ink_list,
@@ -3583,8 +3727,8 @@ static const dyesub_cap_t dyesub_model_capabilities[] =
4003,
&rgb_ink_list,
&res_300dpi_list,
- &kodak_6800_page_list,
- &kodak_6800_printsize_list,
+ &kodak_605_page_list,
+ &kodak_605_printsize_list,
SHRT_MAX,
DYESUB_FEATURE_FULL_WIDTH | DYESUB_FEATURE_FULL_HEIGHT,
&kodak_605_printer_init, NULL,
diff --git a/src/testpattern/run-testpattern-2.in b/src/testpattern/run-testpattern-2.in
index 0ab1320..ed1a21c 100644
--- a/src/testpattern/run-testpattern-2.in
+++ b/src/testpattern/run-testpattern-2.in
@@ -8,8 +8,9 @@ use strict;
my $valgrind = 0;
my $callgrind = 0;
my $gdb_attach = 0;
-my $calc_md5_file = undef;
-my $calc_md5_dir = undef;
+my $csum_file = undef;
+my $csum_dir = undef;
+my $csum_type = 'sha512';
my $dontrun = 0;
my $retval = 0;
my $halt_on_error = 0;
@@ -72,34 +73,35 @@ my %stp_float_values;
my %stp_int_values;
my %rerun_cases;
-GetOptions("v+" => \$valgrind,
- "c" => \$callgrind,
- "g" => \$gdb_attach,
+GetOptions("C=s" => \$csum_type,
"G=s" => \$geometry,
- "n" => \$dontrun,
- "p:i" => \$std_pages,
- "P:i" => \$duplex_pages,
- "s!" => \$skip_duplicate_printers,
- "S+" => \$single,
"H!" => \$halt_on_error,
- "i!" => \$run_installed,
- "r!" => \$skip_resolutions,
- "R+" => \$use_min_res,
- "q+" => \$quiet,
- "o=s" => \@special_options,
- "f=s" => \@families,
+ "L" => \$list_options,
+ "M:s" => \$csum_file,
"O=s" => \$output,
- "d=s" => \@default_options,
- "m:s" => \$calc_md5_dir,
- "M:s" => \$calc_md5_file,
+ "P:i" => \$duplex_pages,
+ "R+" => \$use_min_res,
+ "S+" => \$single,
+ "V+" => \$verbose,
"X" => \$rerun,
- "x=s" => \@exclude_list,
"Y=s" => \@include_patterns,
- "y=s" => \@exclude_patterns,
+ "c" => \$callgrind,
+ "d=s" => \@default_options,
+ "f=s" => \@families,
+ "g" => \$gdb_attach,
+ "h" => \$help,
+ "i!" => \$run_installed,
"l" => \$list_printers,
- "L" => \$list_options,
- "V+" => \$verbose,
- "h" => \$help);
+ "m:s" => \$csum_dir,
+ "n" => \$dontrun,
+ "o=s" => \@special_options,
+ "p:i" => \$std_pages,
+ "q+" => \$quiet,
+ "r!" => \$skip_resolutions,
+ "s!" => \$skip_duplicate_printers,
+ "v+" => \$valgrind,
+ "x=s" => \@exclude_list,
+ "y=s" => \@exclude_patterns);
sub print_help_and_exit() {
my $options = join("\n ", sort @standard_options);
@@ -109,7 +111,7 @@ Usage: run-testpattern-2 [opts] [model ...]
Printer selection options:
-f family Test printers only in the specified family. Multiple
families may be tested. By default, all printer families
- are tested.
+ are tested.
-s Skip duplicate printers (with the same model number
in printers.xml).
-x printer Do not test the specified printer.
@@ -117,14 +119,22 @@ Usage: run-testpattern-2 [opts] [model ...]
-Y pattern Only test printers matching the specified pattern(s).
Logging options:
- -m md5_dir Generate MD5 checksums and place them in the specified
+ -C csum_type Generate specified checksum type (default $csum_type). Options:
+ - md5
+ - sha
+ - sha1
+ - sha224
+ - ssh256
+ - sha384
+ - sha512
+ -m csum_dir Generate checksums and place them in the specified
directory, one file per run. Directory will be created
- if necessary.
- -M md5_file Generate MD5 checksums and place them in the specified
+ if necessary.
+ -M csum_file Generate checksums and place them in the specified
file, one line per run.
-O out_dir Generate actual output and place it in the specified
directory, one file per run. Directory will be created
- if necessary.
+ if necessary.
Control options:
-H Halt on any error.
@@ -142,14 +152,14 @@ Usage: run-testpattern-2 [opts] [model ...]
Test selection options:
-d option=value Test this option with only the specified (default) value,
- if available.
+ if available.
-G geometry Specify geometry (=(HxV)(+L+T), as fractions of page).
-o option Test this option. Multiple -o options may be specified.
option1,option2... tests all combinations of each
- option. For floating point and integer options, a
- selection of values is tested.
- Default:
- $options
+ option. For floating point and integer options, a
+ selection of values is tested.
+ Default:
+ $options
-p page count Specify number of pages to print per printer. Default $std_pages.
-P page count Specify number of pages to print per printer when testing
duplex mode. Default $duplex_pages.
@@ -464,30 +474,30 @@ sub do_print($$) {
sub do_output($) {
my ($outkey) = @_;
- if (defined $output || defined $calc_md5_dir ||
- defined $calc_md5_file) {
- my $md5_cmd;
+ if (defined $output || defined $csum_dir ||
+ defined $csum_file) {
+ my $checksum_cmd;
my $outbase = "${outkey}.prn";
my $outfile = "$output/$outbase";
- if (defined $calc_md5_file) {
- $md5_cmd = "md5sum -b | sed 's/-/$outbase/' >> '$calc_md5_file'";
- } elsif (defined $calc_md5_dir) {
- my $md5_dir = $calc_md5_dir;
- if (defined $calc_md5_dir && $calc_md5_dir eq "") {
- $md5_dir = $output;
+ if (defined $csum_file) {
+ $checksum_cmd = "${csum_type}sum -b | sed 's/-/$outbase/' >> '$csum_file'";
+ } elsif (defined $csum_dir) {
+ my $checksum_dir = $csum_dir;
+ if (defined $csum_dir && $csum_dir eq "") {
+ $checksum_dir = $output;
}
- my $md5file = "$md5_dir/${outkey}.md5";
- if (! $md5_dir) {
- $md5file = "${outkey}.md5";
+ my $checksumfile = "$checksum_dir/${outkey}.checksum";
+ if (! $checksum_dir) {
+ $checksumfile = "${outkey}.checksum";
}
- $md5_cmd = "md5sum -b | sed 's/-/$outbase/' > '$md5file'";
+ $checksum_cmd = "${csum_type}sum -b | sed 's/-/$outbase/' > '$checksumfile'";
}
- if ($output && $md5_cmd ne "") {
- push @job_extras, "output \"|tee '$outfile' | $md5_cmd\";\n";
+ if ($output && $checksum_cmd ne "") {
+ push @job_extras, "output \"|tee '$outfile' | $checksum_cmd\";\n";
} elsif ($output) {
push @job_extras, "output \"$outfile\";\n";
} else {
- push @job_extras, "output \"|$md5_cmd\";\n";
+ push @job_extras, "output \"|$checksum_cmd\";\n";
}
}
}
@@ -708,7 +718,7 @@ if ($rerun) {
while (<>) {
chomp;
s/^[^a-zA-Z]*//;
- s/\.prn//;
+ s/\..*//;
$rerun_cases{$_} = 1;
}
}
@@ -823,19 +833,19 @@ if ($list_options) {
mkdir $output || die "Can't create directory $output: $!\n";
}
- if (defined $calc_md5_dir && $calc_md5_dir ne "" && ! -d $calc_md5_dir) {
- mkdir $calc_md5_dir || die "Can't create directory $calc_md5_dir: $!\n";
+ if (defined $csum_dir && $csum_dir ne "" && ! -d $csum_dir) {
+ mkdir $csum_dir || die "Can't create directory $csum_dir: $!\n";
}
- if (defined $calc_md5_file) {
- unlink $calc_md5_file;
- system "touch $calc_md5_file";
+ if (defined $csum_file) {
+ unlink $csum_file;
+ system "touch $csum_file";
}
my $status = 1;
my ($suppress);
- if (! defined $output && ! defined $calc_md5_dir &&
- ! defined $calc_md5_file) {
+ if (! defined $output && ! defined $csum_dir &&
+ ! defined $csum_file) {
$suppress = '-n';
}
my ($qopt) = $quiet ? "-q" : "";
diff --git a/src/testpattern/testpattern.c b/src/testpattern/testpattern.c
index e4bd63b..b31128f 100644
--- a/src/testpattern/testpattern.c
+++ b/src/testpattern/testpattern.c
@@ -1,7 +1,7 @@
/*
- * "$Id: testpattern.c,v 1.60 2014/01/04 00:30:27 rlk Exp $"
+ * "$Id: testpattern.c,v 1.64 2014/05/17 21:56:46 rlk Exp $"
*
- * Test pattern generator for Gimp-Print
+ * Test pattern generator for Gutenprint
*
* Copyright 2001 Robert Krawitz <rlk@alum.mit.edu>
*
@@ -22,7 +22,7 @@
/*
* This sample program may be used to generate test patterns. It also
- * serves as an example of how to use the gimp-print API.
+ * serves as an example of how to use the Gutenprint API.
*
* As the purpose of this program is to allow fine grained control over
* the output, it uses the raw CMYK output type. This feeds 16 bits each
@@ -105,6 +105,7 @@ int end_job = 0;
int passes = 0;
int failures = 0;
int skipped = 0;
+size_t bytes_written = 0;
static testpattern_t *static_testpatterns;
@@ -189,13 +190,12 @@ static void
writefunc(void *file, const char *buf, size_t bytes)
{
FILE *prn = (FILE *)file;
+ bytes_written += bytes;
if (! file)
return;
if (file == stderr)
{
- if (global_quiet)
- fputc('-', prn);
- else
+ if (!global_quiet)
fwrite(buf, 1, bytes, prn);
}
else if (!global_suppress_output)
@@ -307,6 +307,7 @@ do_print(void)
}
return 2;
}
+ bytes_written = 0;
if (global_output)
{
if (strcmp(global_output, "-") == 0)
@@ -467,6 +468,7 @@ do_print(void)
stp_merge_printvars(v, stp_printer_get_defaults(the_printer));
if (stp_verify(v))
{
+ bytes_written = 0;
if (start_job)
{
stp_start_job(v, &theImage);
@@ -481,6 +483,15 @@ do_print(void)
if (global_halt_on_error)
return status;
}
+ else if (bytes_written == 0)
+ {
+ if (!global_quiet)
+ fputs("FAILED: No output", stderr);
+ failures++;
+ status = 2;
+ if (global_halt_on_error)
+ return status;
+ }
else
passes++;
if (end_job)
@@ -503,7 +514,7 @@ do_print(void)
else
{
if (!global_quiet)
- fprintf(stderr, "(skipped)");
+ fputs("(skipped)", stderr);
skipped++;
}
}
@@ -1162,14 +1173,20 @@ Image_get_row(stp_image_t *image, unsigned char *data,
return STP_IMAGE_STATUS_OK;
}
-static int
-Image_width(stp_image_t *image)
+static void
+check_valid_image(const char *s)
{
if (! Image_is_valid)
{
- fputs("Calling Image_width with invalid image!\n", stderr);
+ fputs(s, stderr);
abort();
}
+}
+
+static int
+Image_width(stp_image_t *image)
+{
+ check_valid_image("Calling Image_width with invalid image!\n");
if (static_testpatterns[0].type == E_IMAGE)
return static_testpatterns[0].d.image.x;
else
@@ -1179,11 +1196,7 @@ Image_width(stp_image_t *image)
static int
Image_height(stp_image_t *image)
{
- if (! Image_is_valid)
- {
- fputs("Calling Image_height with invalid image!\n", stderr);
- abort();
- }
+ check_valid_image("Calling Image_height with invalid image!\n");
if (static_testpatterns[0].type == E_IMAGE)
return static_testpatterns[0].d.image.y;
else
@@ -1205,32 +1218,20 @@ Image_init(stp_image_t *image)
static void
Image_reset(stp_image_t *image)
{
- if (!Image_is_valid)
- {
- fputs("Calling Image_reset with invalid image!\n", stderr);
- abort();
- }
+ check_valid_image("Calling Image_reset with invalid image!\n");
/* dummy function */
}
static void
Image_conclude(stp_image_t *image)
{
- if (! Image_is_valid)
- {
- fputs("Calling Image_conclude with invalid image!\n", stderr);
- abort();
- }
+ check_valid_image("Calling Image_conclude with invalid image!\n");
Image_is_valid = 0;
}
static const char *
Image_get_appname(stp_image_t *image)
{
- if (! Image_is_valid)
- {
- fprintf(stderr, "Calling Image_get_appname with invalid image!\n");
- abort();
- }
+ check_valid_image("Calling Image_get_appname with invalid image!\n");
return "Test Pattern";
}
diff --git a/src/xml/printers.xml b/src/xml/printers.xml
index 3e3c91f..a943dc8 100644
--- a/src/xml/printers.xml
+++ b/src/xml/printers.xml
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!--
- "$Id: printers.xml,v 1.355 2014/02/16 15:05:50 rlk Exp $"
+ "$Id: printers.xml,v 1.357 2014/05/08 12:58:54 speachy Exp $"
XML description of printers known to libgutenprint
You can add additional printers here, but the underlying driver has
@@ -2575,7 +2575,9 @@
<printer translate="name" name="Canon SELPHY CP790" deviceid="MFG:Canon;CMD:Raster3;MDL:CP790;CLS:PRINTER;DES:Canon CP790;VER:1.00;" driver="canon-cp790" manufacturer="Canon" model="1008" foomaticid="Canon-SELPHY-CP790" />
<printer translate="name" name="Canon SELPHY CP800" deviceid="MFG:Canon;CMD:Raster3;MDL:CP800;CLS:PRINTER;DES:Canon CP800;VER:1.00;" driver="canon-cp800" manufacturer="Canon" model="1009" foomaticid="Canon-SELPHY-CP800" />
<printer translate="name" name="Canon SELPHY CP810" deviceid="MFG:Canon;CMD:Raster3;MDL:CP810;CLS:PRINTER;DES:Canon CP810;VER:3.05;" driver="canon-cp810" manufacturer="Canon" model="1009" foomaticid="Canon-SELPHY-CP810" />
+<!-- <printer translate="name" name="Canon SELPHY CP820" driver="canon-cp820" manufacturer="Canon" model="1011" foomaticid="Canon-SELPHY-CP820" /> -->
<printer translate="name" name="Canon SELPHY CP900" driver="canon-cp900" manufacturer="Canon" model="1010" foomaticid="Canon-SELPHY-CP900" />
+<!-- <printer translate="name" name="Canon SELPHY CP910" deviceid="MFG:Canon;CMD:Raster3;MDL:CP910;CLS:PRINTER;DES:Canon CP910;VER:1.00;CID:CA_YCC_ICP;" driver="canon-cp910" manufacturer="Canon" model="1011" foomaticid="Canon-SELPHY-CP910" /> -->
<printer translate="name" name="Canon SELPHY ES1" deviceid="MFG:Canon;CMD:Raster3;MDL:ES1;CLS:PRINTER;DES:Canon SELPHY ES1;VER:1.00;" driver="canon-es1" manufacturer="Canon" model="1003" foomaticid="Canon-SELPHY-ES1" />
<printer translate="name" name="Canon SELPHY ES2" deviceid="MFG:Canon;CMD:Raster3;MDL:ES2;CLS:PRINTER;DES:Canon SELPHY ES2;VER:1.00;" driver="canon-es2" manufacturer="Canon" model="1005" foomaticid="Canon-SELPHY-ES2" />
<printer translate="name" name="Canon SELPHY ES3" deviceid="MFG:Canon;CMD:Raster3;MDL:ES3;CLS:PRINTER;DES:Canon SELPHY ES3;VER:1.00;" driver="canon-es3" manufacturer="Canon" model="1006" foomaticid="Canon-SELPHY-ES3" />