[Pkg-cups-devel] r397 - in cupsys/branches/cups-1.2-ubuntu/debian:
. patches
Martin Pitt
mpitt at costa.debian.org
Mon Oct 9 14:03:09 UTC 2006
Author: mpitt
Date: Mon Oct 9 14:03:08 2006
New Revision: 397
Added:
cupsys/branches/cups-1.2-ubuntu/debian/patches/15_usb-devname.dpatch
Modified:
cupsys/branches/cups-1.2-ubuntu/debian/changelog
cupsys/branches/cups-1.2-ubuntu/debian/patches/00list
Log:
* Add debian/patches/15_usb-devname.dpatch:
- Removing the first USB printer caused other USB printers to be
inaccessible.
- Upstream: STR#2017
- Closes: LP#64725
Modified: cupsys/branches/cups-1.2-ubuntu/debian/changelog
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/changelog (original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/changelog Mon Oct 9 14:03:08 2006
@@ -1,3 +1,13 @@
+cupsys (1.2.4-2ubuntu3) edgy; urgency=low
+
+ * Add debian/patches/15_usb-devname.dpatch:
+ - Removing the first USB printer caused other USB printers to be
+ inaccessible.
+ - Upstream: STR#2017
+ - Closes: LP#64725
+
+ -- Matthias Urlichs <smurf at ubuntu.com> Sun, 8 Oct 2006 18:06:23 +0200
+
cupsys (1.2.4-2ubuntu2) edgy; urgency=low
* debian/rules: Do not install http/ipp backend with 0700 permissions
Modified: cupsys/branches/cups-1.2-ubuntu/debian/patches/00list
==============================================================================
--- cupsys/branches/cups-1.2-ubuntu/debian/patches/00list (original)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/00list Mon Oct 9 14:03:08 2006
@@ -13,6 +13,7 @@
12_quiesce_ipp_logging.dpatch
13_default_log_warn.dpatch
14_dont_force_ssl.dpatch
+15_usb-devname.dpatch
19_cupsaccept.dpatch
#26_modprobe.dpatch
44_fixconfdirperms.dpatch
Added: cupsys/branches/cups-1.2-ubuntu/debian/patches/15_usb-devname.dpatch
==============================================================================
--- (empty file)
+++ cupsys/branches/cups-1.2-ubuntu/debian/patches/15_usb-devname.dpatch Mon Oct 9 14:03:08 2006
@@ -0,0 +1,114 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 15_usb-devname.dpatch by Matthias Urlichs <smurf at ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: cupsys' device-name discovery depends on the fact that printers
+## DP: are named consecutively, and defaults to /dev/usb/lp## if the
+## DP: first printer has vanished. That does not work with the default
+## DP: 2.6 kernel and udev.
+## DP: Without this patch, unplugging the first USB printer hides all of them.
+
+ at DPATCH@
+--- cupsys-1.2.4/backend/usb-unix.c 2006-07-12 22:00:11.000000000 +0200
++++ cupsys/backend/usb-unix.c 2006-10-08 20:19:03.000000000 +0200
+@@ -187,42 +187,38 @@
+ #ifdef __linux
+ int i; /* Looping var */
+ int fd; /* File descriptor */
+- char format[255], /* Format for device filename */
+- device[255], /* Device filename */
++ char device[255], /* Device filename */
+ device_id[1024], /* Device ID string */
+ device_uri[1024], /* Device URI string */
+ make_model[1024]; /* Make and model */
+
+-
+ /*
+- * First figure out which USB printer filename to use...
+- */
+-
+- if (!access("/dev/usblp0", 0))
+- strcpy(format, "/dev/usblp%d");
+- else if (!access("/dev/usb/usblp0", 0))
+- strcpy(format, "/dev/usb/usblp%d");
+- else
+- strcpy(format, "/dev/usb/lp%d");
+-
+- /*
+- * Then open each USB device...
++ * Try to open each USB device...
+ */
+
+ for (i = 0; i < 16; i ++)
+ {
+- sprintf(device, format, i);
++ sprintf(device, "/dev/usblp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0) {
++ if (errno != ENOENT)
++ continue;
++ sprintf(device, "/dev/usb/lp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0) {
++ if (errno != ENOENT)
++ continue;
++ sprintf(device, "/dev/usb/usblp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0)
++ continue;
++ }
++ }
+
+- if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
+- {
+- if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
+- make_model, sizeof(make_model),
+- "usb", device_uri, sizeof(device_uri)))
++ if (!backendGetDeviceID(fd, device_id, sizeof(device_id),
++ make_model, sizeof(make_model),
++ "usb", device_uri, sizeof(device_uri)))
+ printf("direct %s \"%s\" \"%s USB #%d\" \"%s\"\n", device_uri,
+ make_model, make_model, i + 1, device_id);
+
+- close(fd);
+- }
++ close(fd);
+ }
+ #elif defined(__sgi)
+ #elif defined(__sun) && defined(ECPPIOC_GETDEVID)
+@@ -317,27 +313,24 @@
+
+
+ /*
+- * First figure out which USB printer filename to use...
+- */
+-
+- if (!access("/dev/usblp0", 0))
+- strcpy(format, "/dev/usblp%d");
+- else if (!access("/dev/usb/usblp0", 0))
+- strcpy(format, "/dev/usb/usblp%d");
+- else
+- strcpy(format, "/dev/usb/lp%d");
+-
+- /*
+- * Then find the correct USB device...
++ * Find the correct USB device...
+ */
+
+ do
+ {
+ for (busy = 0, i = 0; i < 16; i ++)
+ {
+- sprintf(device, format, i);
++ sprintf(device, "/dev/usblp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT) {
++ sprintf(device, "/dev/usb/lp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT) {
++ sprintf(device, "/dev/usb/usblp%d", i);
++ if ((fd = open(device, O_RDWR | O_EXCL)) < 0 && errno == ENOENT)
++ continue;
++ }
++ }
+
+- if ((fd = open(device, O_RDWR | O_EXCL)) >= 0)
++ if (fd >= 0)
+ {
+ backendGetDeviceID(fd, device_id, sizeof(device_id),
+ make_model, sizeof(make_model),
More information about the Pkg-cups-devel
mailing list