ports/opt (2.7): [notify] cups: update to 1.5.0
commit d112d9405c74edfec73334b4bbc0054f255fb11e Author: Juergen Daubert <jue@jue.li> Date: Sun Jan 15 16:33:02 2012 +0100 [notify] cups: update to 1.5.0 the kernel module 'usblp' is no longer supported, see README diff --git a/cups/.footprint b/cups/.footprint index ac88770..024b6a1 100644 --- a/cups/.footprint +++ b/cups/.footprint @@ -1,3 +1,6 @@ +drwxr-xr-x root/root Resources/ +drwxr-xr-x root/root Resources/English.lproj/ +-rw-r--r-- root/root Resources/English.lproj/cups.strings drwxr-xr-x root/root etc/ drwxr-xr-x root/lp etc/cups/ -rw-r----- root/lp etc/cups/cupsd.conf @@ -6,6 +9,8 @@ drwxr-xr-x root/lp etc/cups/interfaces/ drwxr-xr-x root/lp etc/cups/ppd/ -rw-r----- root/lp etc/cups/snmp.conf drwx------ root/lp etc/cups/ssl/ +drwxr-xr-x root/root etc/modprobe.d/ +-rw-r--r-- root/root etc/modprobe.d/cups.conf drwxr-xr-x root/root etc/rc.d/ -rwxr-xr-x root/root etc/rc.d/cups drwxr-xr-x root/root etc/ssl/ @@ -19,6 +24,7 @@ drwxr-xr-x root/root usr/bin/ -rwxr-xr-x root/root usr/bin/cups-config -rwxr-xr-x root/root usr/bin/cupstestdsc -rwxr-xr-x root/root usr/bin/cupstestppd +-rwxr-xr-x root/root usr/bin/ipptool -rwxr-xr-x root/root usr/bin/lp -rwxr-xr-x root/root usr/bin/lpoptions -rwxr-xr-x root/root usr/bin/lppasswd @@ -57,10 +63,11 @@ drwxr-xr-x root/root usr/lib/ drwxr-xr-x root/root usr/lib/cups/ drwxr-xr-x root/root usr/lib/cups/backend/ lrwxrwxrwx root/root usr/lib/cups/backend/http -> ipp +lrwxrwxrwx root/root usr/lib/cups/backend/https -> ipp -rwx------ root/root usr/lib/cups/backend/ipp +lrwxrwxrwx root/root usr/lib/cups/backend/ipps -> ipp -rwx------ root/root usr/lib/cups/backend/lpd -rwxr-xr-x root/root usr/lib/cups/backend/parallel --rwxr-xr-x root/root usr/lib/cups/backend/scsi -rwxr-xr-x root/root usr/lib/cups/backend/serial -rwxr-xr-x root/root usr/lib/cups/backend/snmp -rwxr-xr-x root/root usr/lib/cups/backend/socket @@ -74,6 +81,7 @@ drwxr-xr-x root/root usr/lib/cups/cgi-bin/ drwxr-xr-x root/root usr/lib/cups/daemon/ -rwxr-xr-x root/root usr/lib/cups/daemon/cups-deviced -rwxr-xr-x root/root usr/lib/cups/daemon/cups-driverd +-rwxr-xr-x root/root usr/lib/cups/daemon/cups-exec -rwxr-xr-x root/root usr/lib/cups/daemon/cups-lpd -rwxr-xr-x root/root usr/lib/cups/daemon/cups-polld drwxr-xr-x root/root usr/lib/cups/driver/ @@ -83,7 +91,6 @@ drwxr-xr-x root/root usr/lib/cups/filter/ -rwxr-xr-x root/root usr/lib/cups/filter/commandtopclx -rwxr-xr-x root/root usr/lib/cups/filter/commandtops -rwxr-xr-x root/root usr/lib/cups/filter/gziptoany --rwxr-xr-x root/root usr/lib/cups/filter/hpgltops -rwxr-xr-x root/root usr/lib/cups/filter/imagetops -rwxr-xr-x root/root usr/lib/cups/filter/imagetoraster -rwxr-xr-x root/root usr/lib/cups/filter/pdftops @@ -94,6 +101,7 @@ lrwxrwxrwx root/root usr/lib/cups/filter/rastertodymo -> rastertolabel -rwxr-xr-x root/root usr/lib/cups/filter/rastertohp -rwxr-xr-x root/root usr/lib/cups/filter/rastertolabel -rwxr-xr-x root/root usr/lib/cups/filter/rastertopclx +-rwxr-xr-x root/root usr/lib/cups/filter/rastertopwg -rwxr-xr-x root/root usr/lib/cups/filter/texttops drwxr-xr-x root/root usr/lib/cups/monitor/ -rwxr-xr-x root/root usr/lib/cups/monitor/bcp @@ -119,6 +127,7 @@ drwxr-xr-x root/root usr/man/man1/ -rw-r--r-- root/root usr/man/man1/cups-config.1.gz -rw-r--r-- root/root usr/man/man1/cupstestdsc.1.gz -rw-r--r-- root/root usr/man/man1/cupstestppd.1.gz +-rw-r--r-- root/root usr/man/man1/ipptool.1.gz -rw-r--r-- root/root usr/man/man1/lp.1.gz -rw-r--r-- root/root usr/man/man1/lpoptions.1.gz -rw-r--r-- root/root usr/man/man1/lppasswd.1.gz @@ -136,6 +145,7 @@ drwxr-xr-x root/root usr/man/man5/ -rw-r--r-- root/root usr/man/man5/client.conf.5.gz -rw-r--r-- root/root usr/man/man5/cups-snmp.conf.5.gz -rw-r--r-- root/root usr/man/man5/cupsd.conf.5.gz +-rw-r--r-- root/root usr/man/man5/ipptoolfile.5.gz -rw-r--r-- root/root usr/man/man5/mailto.conf.5.gz -rw-r--r-- root/root usr/man/man5/mime.convs.5.gz -rw-r--r-- root/root usr/man/man5/mime.types.5.gz @@ -189,49 +199,9 @@ drwxr-xr-x root/root usr/share/cups/banners/ -rw-r--r-- root/root usr/share/cups/banners/standard -rw-r--r-- root/root usr/share/cups/banners/topsecret -rw-r--r-- root/root usr/share/cups/banners/unclassified -drwxr-xr-x root/root usr/share/cups/charmaps/ --rw-r--r-- root/root usr/share/cups/charmaps/euc-cn.txt --rw-r--r-- root/root usr/share/cups/charmaps/euc-jp.txt --rw-r--r-- root/root usr/share/cups/charmaps/euc-kr.txt --rw-r--r-- root/root usr/share/cups/charmaps/euc-tw.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-1.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-10.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-11.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-13.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-14.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-15.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-16.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-2.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-3.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-4.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-5.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-6.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-7.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-8.txt --rw-r--r-- root/root usr/share/cups/charmaps/iso-8859-9.txt --rw-r--r-- root/root usr/share/cups/charmaps/jis-x0213.txt --rw-r--r-- root/root usr/share/cups/charmaps/koi8-r.txt --rw-r--r-- root/root usr/share/cups/charmaps/koi8-u.txt --rw-r--r-- root/root usr/share/cups/charmaps/mac-roman.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1250.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1251.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1252.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1253.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1254.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1255.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1256.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1257.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1258.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-1361.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-874.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-932.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-936.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-949.txt --rw-r--r-- root/root usr/share/cups/charmaps/windows-950.txt drwxr-xr-x root/root usr/share/cups/charsets/ -rw-r--r-- root/root usr/share/cups/charsets/utf-8 drwxr-xr-x root/root usr/share/cups/data/ --rw-r--r-- root/root usr/share/cups/data/HPGLprolog -rw-r--r-- root/root usr/share/cups/data/psglyphs -rw-r--r-- root/root usr/share/cups/data/testprint drwxr-xr-x root/root usr/share/cups/doc/ @@ -267,6 +237,8 @@ drwxr-xr-x root/root usr/share/cups/doc/help/ -rw-r--r-- root/root usr/share/cups/doc/help/man-cupstestdsc.html -rw-r--r-- root/root usr/share/cups/doc/help/man-cupstestppd.html -rw-r--r-- root/root usr/share/cups/doc/help/man-filter.html +-rw-r--r-- root/root usr/share/cups/doc/help/man-ipptool.html +-rw-r--r-- root/root usr/share/cups/doc/help/man-ipptoolfile.html -rw-r--r-- root/root usr/share/cups/doc/help/man-lp.html -rw-r--r-- root/root usr/share/cups/doc/help/man-lpadmin.html -rw-r--r-- root/root usr/share/cups/doc/help/man-lpc.html @@ -359,6 +331,17 @@ drwxr-xr-x root/root usr/share/cups/fonts/ -rw-r--r-- root/root usr/share/cups/fonts/Monospace-Bold -rw-r--r-- root/root usr/share/cups/fonts/Monospace-BoldOblique -rw-r--r-- root/root usr/share/cups/fonts/Monospace-Oblique +drwxr-xr-x root/root usr/share/cups/ipptool/ +-rw-r--r-- root/root usr/share/cups/ipptool/create-printer-subscription.test +-rw-r--r-- root/root usr/share/cups/ipptool/get-completed-jobs.test +-rw-r--r-- root/root usr/share/cups/ipptool/get-jobs.test +-rw-r--r-- root/root usr/share/cups/ipptool/ipp-1.1.test +-rw-r--r-- root/root usr/share/cups/ipptool/ipp-2.0.test +-rw-r--r-- root/root usr/share/cups/ipptool/ipp-2.1.test +-rw-r--r-- root/root usr/share/cups/ipptool/testfile.jpg +-rw-r--r-- root/root usr/share/cups/ipptool/testfile.pdf +-rw-r--r-- root/root usr/share/cups/ipptool/testfile.ps +-rw-r--r-- root/root usr/share/cups/ipptool/testfile.txt drwxr-xr-x root/root usr/share/cups/mime/ -rw-r--r-- root/root usr/share/cups/mime/mime.convs -rw-r--r-- root/root usr/share/cups/mime/mime.types diff --git a/cups/.md5sum b/cups/.md5sum index 8c8ead5..136c429 100644 --- a/cups/.md5sum +++ b/cups/.md5sum @@ -1,4 +1,5 @@ 01b6a755c5b0fb7df2d2c94571f67e1d cups -0ec52d3f3c69bc2ab5ed70c594edbce6 cups-1.4.8-source.tar.bz2 +e54ed09ede2340fc3014913333520fe4 cups-1.5.0-source.tar.bz2 2220f411940c4f7504ed4457c6304d4a cups-config.patch -4a94252a0deb74c6fe12f373be576182 usb-backend-both-usblp-and-libusb.dpatch +6f0218c33be40ef6469965df26a55bd6 usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch +c8ece8955359cb85c044ea8ec50690fa usb-skip-interface-altsetting.patch diff --git a/cups/Pkgfile b/cups/Pkgfile index 1689704..58c7d22 100644 --- a/cups/Pkgfile +++ b/cups/Pkgfile @@ -4,16 +4,19 @@ # Depends on: acl tcp_wrappers libusb-compat libpng libtiff openssl poppler name=cups -version=1.4.8 -release=3 +version=1.5.0 +release=1 source=(http://ftp.easysw.com/pub/cups/$version/$name-$version-source.tar.bz2 - cups-config.patch cups usb-backend-both-usblp-and-libusb.dpatch) + cups-config.patch cups + usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch + usb-skip-interface-altsetting.patch) build () { cd $name-$version patch -p1 -i $SRC/cups-config.patch - patch -p1 -i $SRC/usb-backend-both-usblp-and-libusb.dpatch + patch -p1 -i $SRC/usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch + patch -p0 -d backend -i $SRC/usb-skip-interface-altsetting.patch ./configure --prefix=/usr \ --sysconfdir=/etc \ @@ -47,4 +50,8 @@ build () { chmod 0600 $PKG/etc/ssl/{keys/cups.key,certs/cups.crt} install -D -m 755 $SRC/cups $PKG/etc/rc.d/cups + + # blacklist usblp kernel module + install -d $PKG/etc/modprobe.d + echo 'blacklist usblp' > $PKG/etc/modprobe.d/cups.conf } diff --git a/cups/README b/cups/README index eb2d77a..45fb657 100644 --- a/cups/README +++ b/cups/README @@ -1,9 +1,10 @@ -README for cups 1.3.x +README for cups 1.5.x REQUIREMENTS -1. This version of cups no longer includes a postscript interpreter. Install - the ghostscript port additionally. +1. As of version 1.5 cups needs libusb to print to usb printers, the kernel + modules usblp is no longer supported. + The port installs /etc/modprobe.de/cups.conf to blacklist the module. 2. In order to have more printer drivers available, the installation of the gutenprint port (formerly gimp-print) is recommended. HP DeskJet/LaserJet users should install the hpijs driver. @@ -28,12 +29,10 @@ NOT you must have foomatic-filters installed and must generate a PPD file PRE-INSTALL -1. Remove a installed lprng package. - Cups and lprng cannot be installed together. - POST-INSTALL -1. Configure your printer with the web-interface, http://localhost:631. +1. Remove the usblp kernel module before starting cups. +2. Configure your printer with the web-interface, http://localhost:631. PRECAUTION diff --git a/cups/usb-backend-both-usblp-and-libusb.dpatch b/cups/usb-backend-both-usblp-and-libusb.dpatch deleted file mode 100644 index 88ae9d0..0000000 --- a/cups/usb-backend-both-usblp-and-libusb.dpatch +++ /dev/null @@ -1,574 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## usb-backend-both-usblp-and-libusb.dpatch by <till.kamppeter@gmail.com> -## -## DP: http://www.cups.org/str.php?L3357 - -@DPATCH@ -diff -urNad cups-1.4.3~/backend/Makefile cups-1.4.3/backend/Makefile ---- cups-1.4.3~/backend/Makefile 2010-04-09 15:56:03.735720821 +0200 -+++ cups-1.4.3/backend/Makefile 2010-04-09 15:56:04.335705387 +0200 -@@ -267,7 +267,7 @@ - echo Linking $@... - $(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \ - $(BACKLIBS) $(LIBS) --usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c -+usb.o: usb.c usb-darwin.c usb-hybrid.c usb-libusb.c usb-unix.c - - - # -diff -urNad cups-1.4.3~/backend/ieee1284.c cups-1.4.3/backend/ieee1284.c ---- cups-1.4.3~/backend/ieee1284.c 2009-12-08 03:13:42.000000000 +0100 -+++ cups-1.4.3/backend/ieee1284.c 2010-04-09 15:56:04.335705387 +0200 -@@ -255,6 +255,7 @@ - cups_option_t *values; /* Keys and values in device ID */ - const char *mfg, /* Manufacturer */ - *mdl, /* Model */ -+ *des, /* Description */ - *sern; /* Serial number */ - char temp[256], /* Temporary manufacturer string */ - *tempptr; /* Pointer into temp string */ -@@ -285,10 +286,20 @@ - } - else - { -- strlcpy(temp, make_model, sizeof(temp)); -+ /* -+ * No manufacturer? Use the model string or description... -+ */ -+ -+ if (mdl) -+ _ppdNormalizeMakeAndModel(mdl, temp, sizeof(temp)); -+ else if ((des = cupsGetOption("DESCRIPTION", num_values, values)) != NULL || -+ (des = cupsGetOption("DES", num_values, values)) != NULL) -+ _ppdNormalizeMakeAndModel(des, temp, sizeof(temp)); -+ else -+ strlcpy(temp, "Unknown", sizeof(temp)); - - if ((tempptr = strchr(temp, ' ')) != NULL) -- *tempptr = '\0'; -+ *tempptr = '\0'; - - mfg = temp; - } -diff -urNad cups-1.4.3~/backend/usb-hybrid.c cups-1.4.3/backend/usb-hybrid.c ---- cups-1.4.3~/backend/usb-hybrid.c 1970-01-01 01:00:00.000000000 +0100 -+++ cups-1.4.3/backend/usb-hybrid.c 2010-04-09 15:56:04.345707078 +0200 -@@ -0,0 +1,87 @@ -+/* -+ * "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $" -+ * -+ * USB port backend for the Common UNIX Printing System (CUPS). -+ * -+ * This file is included from "usb.c" when compiled on Linux. -+ * -+ * Copyright 2007-2008 by Apple Inc. -+ * Copyright 1997-2007 by Easy Software Products, all rights reserved. -+ * -+ * These coded instructions, statements, and computer programs are the -+ * property of Apple Inc. and are protected by Federal copyright -+ * law. Distribution and use rights are outlined in the file "LICENSE.txt" -+ * "LICENSE" which should have been included with this file. If this -+ * file is missing or damaged, see the license at "http://www.cups.org/". -+ * -+ * This file is subject to the Apple OS-Developed Software exception. -+ * -+ * Contents: -+ * -+ * print_device() - Print a file to a USB device. -+ * list_devices() - List all USB devices. -+ */ -+ -+/* -+ * Include necessary headers. -+ */ -+ -+#include <sys/select.h> -+ -+/* -+ * Include the two USB implementations used under Linux ... -+ */ -+ -+#include "usb-libusb.c" -+#include "usb-unix.c" -+ -+/* -+ * 'print_device()' - Print a file to a USB device. -+ */ -+ -+int /* O - Exit status */ -+print_device(const char *uri, /* I - Device URI */ -+ const char *hostname, /* I - Hostname/manufacturer */ -+ const char *resource, /* I - Resource/modelname */ -+ char *options, /* I - Device options/serial number */ -+ int print_fd, /* I - File descriptor to print */ -+ int copies, /* I - Copies to print */ -+ int argc, /* I - Number of command-line arguments (6 or 7) */ -+ char *argv[]) /* I - Command-line arguments */ -+{ -+ int result; -+ for(;;) -+ { -+ result = print_device_unix(uri, hostname, resource, options, print_fd, -+ copies, argc, argv); -+ if (result == -1) -+ { -+ result = print_device_libusb(uri, hostname, resource, options, print_fd, -+ copies, argc, argv); -+ if (result == -1) -+ sleep(5); -+ else -+ return(result); -+ } -+ else -+ return(result); -+ } -+} -+ -+/* -+ * 'list_devices()' - List all USB devices. -+ */ -+ -+void -+list_devices(void) -+{ -+ /* Try both discovery methods, each device will appear only under one -+ of them */ -+ list_devices_libusb(); -+ list_devices_unix(); -+} -+ -+ -+/* -+ * End of "$Id: usb-hybrid.c 8807 2009-08-31 18:45:43Z mike $". -+ */ -diff -urNad cups-1.4.3~/backend/usb-libusb.c cups-1.4.3/backend/usb-libusb.c ---- cups-1.4.3~/backend/usb-libusb.c 2009-09-11 22:03:31.000000000 +0200 -+++ cups-1.4.3/backend/usb-libusb.c 2010-04-09 15:56:04.345707078 +0200 -@@ -13,16 +13,16 @@ - * - * Contents: - * -- * list_devices() - List the available printers. -- * print_device() - Print a file to a USB device. -+ * list_devices_libusb() - List the available printers. -+ * print_device_libusb() - Print a file to a USB device. - * close_device() - Close the connection to the USB printer. - * find_device() - Find or enumerate USB printers. - * get_device_id() - Get the IEEE-1284 device ID for the printer. - * list_cb() - List USB printers for discovery. - * make_device_uri() - Create a device URI for a USB printer. -- * open_device() - Open a connection to the USB printer. -+ * open_device_libusb() - Open a connection to the USB printer. - * print_cb() - Find a USB printer for printing. -- * side_cb() - Handle side-channel requests. -+ * side_cb_libusb() - Handle side-channel requests. - */ - - /* -@@ -65,30 +65,30 @@ - static char *make_device_uri(usb_printer_t *printer, - const char *device_id, - char *uri, size_t uri_size); --static int open_device(usb_printer_t *printer, int verbose); -+static int open_device_libusb(usb_printer_t *printer, int verbose); - static int print_cb(usb_printer_t *printer, const char *device_uri, - const char *device_id, const void *data); --static ssize_t side_cb(usb_printer_t *printer, int print_fd); -+static ssize_t side_cb_libusb(usb_printer_t *printer, int print_fd); - - - /* -- * 'list_devices()' - List the available printers. -+ * 'list_devices_libusb()' - List the available printers. - */ - - void --list_devices(void) -+list_devices_libusb(void) - { -- fputs("DEBUG: list_devices\n", stderr); -+ fputs("DEBUG: list_devices_libusb\n", stderr); - find_device(list_cb, NULL); - } - - - /* -- * 'print_device()' - Print a file to a USB device. -+ * 'print_device_libusb()' - Print a file to a USB device. - */ - - int /* O - Exit status */ --print_device(const char *uri, /* I - Device URI */ -+print_device_libusb(const char *uri, /* I - Device URI */ - const char *hostname, /* I - Hostname/manufacturer */ - const char *resource, /* I - Resource/modelname */ - char *options, /* I - Device options/serial number */ -@@ -105,19 +105,23 @@ - struct pollfd pfds[2]; /* Poll descriptors */ - - -- fputs("DEBUG: print_device\n", stderr); -+ fputs("DEBUG: print_device_libusb\n", stderr); - - /* - * Connect to the printer... - */ - -+#if defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) -+ if ((printer = find_device(print_cb, uri)) == NULL) -+ return(-1); -+#else - while ((printer = find_device(print_cb, uri)) == NULL) - { - _cupsLangPuts(stderr, - _("INFO: Waiting for printer to become available...\n")); - sleep(5); - } -- -+#endif - - /* - * If we are printing data from a print driver on stdin, ignore SIGTERM -@@ -189,7 +193,7 @@ - - if (pfds[1].revents & (POLLIN | POLLHUP)) - { -- if ((bytes = side_cb(printer, print_fd)) < 0) -+ if ((bytes = side_cb_libusb(printer, print_fd)) < 0) - pfds[1].events = 0; /* Filter has gone away... */ - else - tbytes += bytes; -@@ -359,7 +363,7 @@ - printer.iface = iface; - printer.handle = NULL; - -- if (!open_device(&printer, data != NULL)) -+ if (!open_device_libusb(&printer, data != NULL)) - { - if (!get_device_id(&printer, device_id, sizeof(device_id))) - { -@@ -583,6 +587,14 @@ - mfg = tempmfg; - } - -+ if (!strncasecmp(mdl, mfg, strlen(mfg))) -+ { -+ mdl += strlen(mfg); -+ -+ while (isspace(*mdl & 255)) -+ mdl ++; -+ } -+ - /* - * Generate the device URI from the manufacturer, model, serial number, - * and interface number... -@@ -611,11 +623,11 @@ - - - /* -- * 'open_device()' - Open a connection to the USB printer. -+ * 'open_device_libusb()' - Open a connection to the USB printer. - */ - - static int /* O - 0 on success, -1 on error */ --open_device(usb_printer_t *printer, /* I - Printer */ -+open_device_libusb(usb_printer_t *printer, /* I - Printer */ - int verbose) /* I - Update connecting-to-device state? */ - { - int number; /* Configuration/interface/altset numbers */ -@@ -733,16 +745,73 @@ - const char *device_id, /* I - IEEE-1284 device ID */ - const void *data) /* I - User data (make, model, S/N) */ - { -- return (!strcmp((char *)data, device_uri)); -+ char *uri = (char *)data, -+ *str1, -+ *str2, -+ buf[255], -+ requested_uri[1024]; -+ -+ /* Work on a copy of uri */ -+ strncpy(requested_uri, uri, sizeof(requested_uri)); -+ requested_uri[sizeof(requested_uri) - 1] = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have an "interface" specification and this -+ * never happens for usblp-discovered URIs, so remove the "interface" -+ * specification from the URI which we are checking currently. This way a -+ * queue for a usblp-discovered printer can now be accessed via libusb -+ */ -+ if (((str1 = strstr(requested_uri, "interface=")) == NULL) && -+ ((str2 = strstr(device_uri, "interface=")) != NULL)) -+ { -+ *(str2 - 1) = '\0'; -+ } -+ -+ /* -+ * Old URI with "serial=?". Cut this part off and consider this as -+ * an URI without serial number -+ */ -+ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI without serial number. Match it also with URIs with serial -+ * number -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ *(str2 - 1) = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have a "serial" specification when the -+ * usblp-discovered URI for the same printer does not have one, as -+ * with libusb we can discover serial numbers also with other methods -+ * than only via the device ID. Therefore we accept also a -+ * usblp-discovered printer without serial number as a match. This we -+ * do by removing the serial number from the queue's (libusb-discovered) -+ * URI before comparing. Also warn the user because of the incapability -+ * of the usblp-based access to distinguish printers by the serial -+ * number. -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ { -+ *(str2 - 1) = '\0'; -+ if (backendGetMakeModel(device_id, buf, sizeof(buf)) == 0) -+ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please make sure that the \"usblp\" kernel module is always unloaded (and blacklisted) and re-create the queues for these printers. Otherwise CUPS will not be able to distinguish them.\n", -+ buf); -+ } -+ -+ return (!strcmp(requested_uri, device_uri)); - } - - - /* -- * 'side_cb()' - Handle side-channel requests. -+ * 'side_cb_libusb()' - Handle side-channel requests. - */ - - static ssize_t /* O - Number of bytes written */ --side_cb(usb_printer_t *printer, /* I - Printer */ -+side_cb_libusb(usb_printer_t *printer, /* I - Printer */ - int print_fd) /* I - File to print */ - { - ssize_t bytes, /* Bytes read/written */ -diff -urNad cups-1.4.3~/backend/usb-unix.c cups-1.4.3/backend/usb-unix.c ---- cups-1.4.3~/backend/usb-unix.c 2009-12-08 03:13:42.000000000 +0100 -+++ cups-1.4.3/backend/usb-unix.c 2010-04-09 15:56:30.799666933 +0200 -@@ -18,10 +18,10 @@ - * - * Contents: - * -- * print_device() - Print a file to a USB device. -- * list_devices() - List all USB devices. -- * open_device() - Open a USB device... -- * side_cb() - Handle side-channel requests... -+ * print_device_unix() - Print a file to a USB device. -+ * list_devices_unix() - List all USB devices. -+ * open_device_unix() - Open a USB device... -+ * side_cb_unix() - Handle side-channel requests... - */ - - /* -@@ -35,17 +35,17 @@ - * Local functions... - */ - --static int open_device(const char *uri, int *use_bc); --static int side_cb(int print_fd, int device_fd, int snmp_fd, -+static int open_device_unix(const char *uri, int *use_bc); -+static int side_cb_unix(int print_fd, int device_fd, int snmp_fd, - http_addr_t *addr, int use_bc); - - - /* -- * 'print_device()' - Print a file to a USB device. -+ * 'print_device_unix()' - Print a file to a USB device. - */ - - int /* O - Exit status */ --print_device(const char *uri, /* I - Device URI */ -+print_device_unix(const char *uri, /* I - Device URI */ - const char *hostname, /* I - Hostname/manufacturer */ - const char *resource, /* I - Resource/modelname */ - char *options, /* I - Device options/serial number */ -@@ -102,7 +102,7 @@ - strncasecmp(hostname, "Minolta", 7); - #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */ - -- if ((device_fd = open_device(uri, &use_bc)) == -1) -+ if ((device_fd = open_device_unix(uri, &use_bc)) == -1) - { - if (getenv("CLASS") != NULL) - { -@@ -132,6 +132,10 @@ - _("INFO: Printer busy; will retry in 10 seconds...\n")); - sleep(10); - } -+#ifdef HAVE_USB_H -+ else -+ return (-1); -+#else - else if (errno == ENXIO || errno == EIO || errno == ENOENT || - errno == ENODEV) - { -@@ -147,6 +151,7 @@ - resource, strerror(errno)); - return (CUPS_BACKEND_FAILED); - } -+#endif - } - } - while (device_fd < 0); -@@ -190,7 +195,7 @@ - tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, NULL); - - #else -- tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb); -+ tbytes = backendRunLoop(print_fd, device_fd, -1, NULL, use_bc, 1, side_cb_unix); - #endif /* __sun */ - - if (print_fd != 0 && tbytes >= 0) -@@ -214,11 +219,11 @@ - - - /* -- * 'list_devices()' - List all USB devices. -+ * 'list_devices_unix()' - List all USB devices. - */ - - void --list_devices(void) -+list_devices_unix(void) - { - #ifdef __linux - int i; /* Looping var */ -@@ -320,11 +325,11 @@ - - - /* -- * 'open_device()' - Open a USB device... -+ * 'open_device_unix()' - Open a USB device... - */ - - static int /* O - File descriptor or -1 on error */ --open_device(const char *uri, /* I - Device URI */ -+open_device_unix(const char *uri, /* I - Device URI */ - int *use_bc) /* O - Set to 0 for unidirectional */ - { - int fd; /* File descriptor */ -@@ -357,9 +362,12 @@ - char device[255], /* Device filename */ - device_id[1024], /* Device ID string */ - make_model[1024], /* Make and model */ -- device_uri[1024]; /* Device URI string */ -- -+ device_uri[1024], /* Device URI string */ -+ requested_uri[1024], /* Device URI string */ -+ *str1, -+ *str2; - -+ - /* - * Find the correct USB device... - */ -@@ -407,7 +415,55 @@ - device_uri[0] = '\0'; - } - -- if (!strcmp(uri, device_uri)) -+ /* Work on a copy of uri */ -+ strncpy(requested_uri, uri, sizeof(requested_uri)); -+ requested_uri[sizeof(requested_uri) - 1] = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have an "interface" specification and this -+ * never happens for usblp-discovered URIs, so remove the "interface" -+ * specification from the URI of the print queue. This way a queue for -+ * a libusb-discovered printer can now be accessed via the usblip kernel -+ * module -+ */ -+ if ((str1 = strstr(requested_uri, "interface=")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI with "serial=?". Cut this part off and consider this as -+ * an URI without serial number -+ */ -+ if ((str1 = strstr(requested_uri, "serial=?")) != NULL) -+ *(str1 - 1) = '\0'; -+ -+ /* -+ * Old URI without serial number. Match it also with URIs with serial -+ * number -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) == NULL) && -+ ((str2 = strstr(device_uri, "serial=")) != NULL)) -+ *(str2 - 1) = '\0'; -+ -+ /* -+ * libusb-discovered URIs can have a "serial" specification when the -+ * usblp-discovered URI for the same printer does not have one, as -+ * with libusb we can discover serial numbers also with other methods -+ * than only via the device ID. Therefore we accept also a -+ * usblp-discovered printer without serial number as a match. This we -+ * do by removing the serial number from the queue's (libusb-discovered) -+ * URI before comparing. Also warn the user because of the incapability -+ * of the usblp-based access to distinguish printers by the serial -+ * number. -+ */ -+ if (((str1 = strstr(requested_uri, "serial=")) != NULL) && -+ ((str2 = strstr(device_uri, "serial=")) == NULL)) -+ { -+ *(str1 - 1) = '\0'; -+ fprintf(stderr, "WARNING: If you have more than one %s printer connected to this machine, please unload (and blacklist) the \"usblp\" kernel module as otherwise CUPS will not be able to distinguish your printers.\n", -+ make_model); -+ } -+ -+ if (!strcmp(requested_uri, device_uri)) - { - /* - * Yes, return this file descriptor... -@@ -433,10 +489,14 @@ - */ - - if (busy) -+ { - _cupsLangPuts(stderr, - _("INFO: Printer busy; will retry in 5 seconds...\n")); - -- sleep(5); -+ sleep(5); -+ } -+ else -+ return -1; - } - } - #elif defined(__sun) && defined(ECPPIOC_GETDEVID) -@@ -557,11 +617,11 @@ - - - /* -- * 'side_cb()' - Handle side-channel requests... -+ * 'side_cb_unix()' - Handle side-channel requests... - */ - - static int /* O - 0 on success, -1 on error */ --side_cb(int print_fd, /* I - Print file */ -+side_cb_unix(int print_fd, /* I - Print file */ - int device_fd, /* I - Device file */ - int snmp_fd, /* I - SNMP socket (unused) */ - http_addr_t *addr, /* I - Device address (unused) */ -diff -urNad cups-1.4.3~/backend/usb.c cups-1.4.3/backend/usb.c ---- cups-1.4.3~/backend/usb.c 2008-06-24 03:28:36.000000000 +0200 -+++ cups-1.4.3/backend/usb.c 2010-04-09 15:56:04.345707078 +0200 -@@ -56,7 +56,7 @@ - */ - - #ifdef HAVE_USB_H --# include "usb-libusb.c" -+# include "usb-hybrid.c" - #elif defined(__APPLE__) - # include "usb-darwin.c" - #elif defined(__linux) || defined(__sun) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) diff --git a/cups/usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch b/cups/usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch new file mode 100644 index 0000000..019a230 --- /dev/null +++ b/cups/usb-backend-gracefully-fail-on-more-cases-of-bad-device-id.patch @@ -0,0 +1,32 @@ +# http://www.cups.org/str.php?L3978 + +--- a/backend/usb-libusb.c ++++ b/backend/usb-libusb.c +@@ -430,15 +430,26 @@ + * Check to see if the length is larger than our buffer; first + * assume that the vendor incorrectly implemented the 1284 spec, + * and then limit the length to the size of our buffer... ++ * Consider a length < 14 as too short, as the minimum valid device ++ * ID ("MFG:x;MDL:y;") is 12 bytes long and so we have at least 14 ++ * bytes with the two length bytes... ++ * Especially the length in the memmove() call cannot get negative then, ++ * causing the backend to segfault. + */ + +- if (length > bufsize) ++ if ((length > bufsize) || (length < 14)) + length = (((unsigned)buffer[1] & 255) << 8) + + ((unsigned)buffer[0] & 255); + + if (length > bufsize) + length = bufsize; + ++ if (length < 14) ++ { ++ *buffer = '\0'; ++ return (-1); ++ } ++ + length -= 2; + + /* diff --git a/cups/usb-skip-interface-altsetting.patch b/cups/usb-skip-interface-altsetting.patch new file mode 100644 index 0000000..cb72c15 --- /dev/null +++ b/cups/usb-skip-interface-altsetting.patch @@ -0,0 +1,105 @@ +# http://www.cups.org/str.php?L3965 + +Index: usb-libusb.c +=================================================================== +--- usb-libusb.c (revision 10087) ++++ usb-libusb.c (working copy) +@@ -631,6 +631,7 @@ + int verbose) /* I - Update connecting-to-device state? */ + { + int number; /* Configuration/interface/altset numbers */ ++ char current_bConfiguration; + + + /* +@@ -647,27 +648,40 @@ + if ((printer->handle = usb_open(printer->device)) == NULL) + return (-1); + +- /* +- * Then set the desired configuration... +- */ + + if (verbose) + fputs("STATE: +connecting-to-device\n", stderr); + ++ /* ++ * Set the desired configuration, but only if it needs changing. Some ++ * printers (e.g., Samsung) don't like usb_set_configuration. It will succeed, ++ * but the following print job is sometimes silently lost by the printer. ++ */ ++ if (usb_control_msg(printer->handle, ++ USB_TYPE_STANDARD | USB_ENDPOINT_IN | USB_RECIP_DEVICE, ++ 8, /* GET_CONFIGURATION */ ++ 0, 0, ¤t_bConfiguration, 1, 5000) != 1) ++ { ++ current_bConfiguration = 0; /* Failed. Assume not configured */ ++ } ++ + number = printer->device->config[printer->conf].bConfigurationValue; +- +- if (usb_set_configuration(printer->handle, number) < 0) ++ if (number != current_bConfiguration) + { +- /* +- * If the set fails, chances are that the printer only supports a +- * single configuration. Technically these printers don't conform to +- * the USB printer specification, but otherwise they'll work... +- */ + +- if (errno != EBUSY) +- fprintf(stderr, "DEBUG: Failed to set configuration %d for %04x:%04x\n", +- number, printer->device->descriptor.idVendor, +- printer->device->descriptor.idProduct); ++ if (usb_set_configuration(printer->handle, number) < 0) ++ { ++ /* ++ * If the set fails, chances are that the printer only supports a ++ * single configuration. Technically these printers don't conform to ++ * the USB printer specification, but otherwise they'll work... ++ */ ++ ++ if (errno != EBUSY) ++ fprintf(stderr, "DEBUG: Failed to set configuration %d for %04x:%04x\n", ++ number, printer->device->descriptor.idVendor, ++ printer->device->descriptor.idProduct); ++ } + } + + /* +@@ -700,20 +714,24 @@ + #endif /* 0 */ + + /* +- * Set alternate setting... ++ * Set alternate setting, but only if there is more than one option. ++ * Some printers (e.g., Samsung) don't like usb_set_altinterface. + */ +- +- number = printer->device->config[printer->conf].interface[printer->iface]. +- altsetting[printer->altset].bAlternateSetting; +- while (usb_set_altinterface(printer->handle, number) < 0) ++ if (printer->device->config[printer->conf].interface[printer->iface]. ++ num_altsetting > 1) + { +- if (errno != EBUSY) +- fprintf(stderr, +- "DEBUG: Failed to set alternate interface %d for %04x:%04x: %s\n", +- number, printer->device->descriptor.idVendor, +- printer->device->descriptor.idProduct, strerror(errno)); ++ number = printer->device->config[printer->conf].interface[printer->iface]. ++ altsetting[printer->altset].bAlternateSetting; ++ while (usb_set_altinterface(printer->handle, number) < 0) ++ { ++ if (errno != EBUSY) ++ fprintf(stderr, ++ "DEBUG: Failed to set alternate interface %d for %04x:%04x: %s\n", ++ number, printer->device->descriptor.idVendor, ++ printer->device->descriptor.idProduct, strerror(errno)); + +- goto error; ++ goto error; ++ } + } + + if (verbose)
participants (1)
-
crux@crux.nu