-
Notifications
You must be signed in to change notification settings - Fork 464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let the "usb" backend use libusb instead of the usblp kernel module #1575
Comments
CUPS.org User: till.kamppeter Note that the usb-libusb.c was developed with CUPS 1.1.23, a slight change has to be done for CUPS 1.2 to compile it. See attached patch. You need to add "-lusb" to the "LDFLAGS" line in Makedefs after running "./configure" and before running "make". Then you get the libusb-based backend as backend/usb. Replace the original backend in /usr/lib/cups/backend by it. Now it auto-detects the HP PhotoSmart 2600 on USB as follows: [root@majax c]# /usr/lib/cups/backend/usb There is no 1284 device ID, but the web interface still assigns the correct PPD file from HPLIP. The problem is that this backend does not actually print. When printing the test page via the web interface button I get Unable to find USB device "usb://HP/Photosmart%202600%20series?serial=MY53OK70V10400" and the queue gets stopped due to backend failure. So the backend seems to need some further adaptation to CUPS 1.2. |
CUPS.org User: mike Reassigned to -feature; this will not be in 1.2... |
CUPS.org User: twaugh.redhat I've attached a patch against 1.2.0 based on the original usb-libusb.c file. It doesn't attempt to read back-channel data. |
CUPS.org User: twaugh.redhat Oh, I should point out: I made it runtime configurable. Put 'Libusb On' in /etc/cups/usb.conf to make it use libusb. |
CUPS.org User: till.kamppeter I have tried to auto-detect some USB printers using the new backend in libusb mode (works correctly in usblp kernel module mode) and it is still buggy. On the HP PhotoSmart 2600 the device ID is cut off and also the model name (which is taken from the device ID). It seems that the device ID is read into a too small buffer (exactly 32 characters). Device IDs can be long, the buffer should be dynamically sized or have at least 1024 characters. Output on HP PhotoSmart 2600: [root@majax c]# /usr/lib/cups/backend/usb In addition, the internal USB device number ("054" here) should not be included in the output. It changes every time when one disconnects or power-cycles the device. On the HP PSC 950xi the backend was not able to read the device ID at all: [root@majax c]# /usr/lib/cups/backend/usb I did not get any better results by unloading the usblp kernel module, shutting down the HPLIP daemons and power-cycling the devices. |
CUPS.org User: till.kamppeter Printing also does not work with this backend: [root@majax c]# lpinfo -v |
CUPS.org User: mike New code from Couriousous that uses the direct kernel interface instead of libusb... |
CUPS.org User: mike Assigned to 1.3. |
CUPS.org User: mike We'll need a copy of the code that has an explicit copyright assignment to Apple now; none of the included code has any copyright notices... :( Thanks... |
CUPS.org User: mike Pushing this to CUPS 1.4. Ultimately, we need a copyright notice at the top, whether the original author assigns the copyright (or licenses the code) to Apple or we just have the standard GPL header with the author's copyright notice. Otherwise, we can't include the code in CUPS. |
CUPS.org User: till.kamppeter I have tried out Couriousous' alternative USB backend as there are several bug reports about USB printers not being detected correctly: https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.22/+bug/35638 As one cannot exclude that the "usblp" kernel module is the culprit, I wanted to try whether surrounding the module could solve these problems. Therefore I tried to build CUPS 1.3.0 with usb-linux.c instead of usb-unix.c, the method of directly talking to the kernel, without libusb and without the "usblp" module. There were some problems in the backend which I have fixed:
The first two are to assure maximum compatibility to printer setup tools which are developed around the original backend (including the web interface). The third is a kernel bug workaround, as the kernel seems to make an empty /proc/bus/usb in the /proc file system. The last item makes the code simply more friendly for integrating in distros. Installation: Download usb-linux_v2.c from this STR and put it into the backend/ directory of the CUPS source tree. Edit backend/usb.c replacing '#include "usb-unix.c"' by '#include "usb-linux_v2.c"'. Have the "linux-libc-dev" package installed (or the one containing /usr/include/linux/usbdevice_fs.h and /usr/include/linux/usb/ch9.h). Now compile and install CUPS as usual. Usage: Uninstall the "usblp" kernel module via rmmod usblp Then CUPS should work as usual. The new USB backend does not detect any printers nor does it print with the "usblp" module loaded. Blacklist the module if you want to switch to this USB backend permanently. Problems:
There is no problem with HPLIP. The HPLIP CUPS backend works independent whether the "usblp" module is loaded or not. |
CUPS.org User: psmedley Is this still planned to be implemented? OS/2 has libusb support but not usblp. It would be nice to not have to code a native OS/2 usb backend and isntead use libusb :) |
CUPS.org User: mike Current trunk contains a basic libusb implementation - no side- or back-channel support yet,,. |
"usb-libusb-cups-1.2.patch": --- /home/tkamppeter/usb-libusb.c 2006-04-20 16:42:32.000000000 +0200
|
"cups-libusb.patch": --- cups-1.2.0/backend/Makefile.libusb 2006-04-27 14:58:43.000000000 +0100 usb: usb.o ../cups/$(LIBCUPS)
--- cups-1.2.0/backend/usb-unix.c.libusb 2006-05-12 12:22:58.000000000 +0100 /*
+/*
+static struct quirk_printer_struct quirk_printers[] = {
+static unsigned int
int open_device(const char *uri);
+static int
+static int
+/* this is a helper function which call a callback for every printer on the bus.
+static int
+/*
/*
+static usb_dev_handle *
+#ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
+static int
+/*
/*
#ifdef __linux |
Version: 1.4-feature
CUPS.org User: till.kamppeter
As discussed in this thread on linuxprinting.org
http://linuxprinting.org/pipermail/inkjet-list/2006q2/000778.html
http://linuxprinting.org/pipermail/inkjet-list/2006q2/000779.html
http://linuxprinting.org/pipermail/inkjet-list/2006q2/000780.html
and also due to problems reported with Epson multi-function devices and recent kernels it can make sense to let the "usb" backend of CUPS not use the "usblp" kernel module any more, but libusb (SANE also switched from a kernel module for USB scanners to libusb, also HPLIP from HP did so).
Our Mandriva contributor Couriousous (couriousous at mandriva dot org, couriousous at sceen dot net) has sent to me a libusb-based USB CUPS backend once (attached), which could be the start for the development of a new USB backend for CUPS.
Build instructions:
variable)
one).
My suggestion would be either to switch the current backend to libusb-only or better to make it runtime-configurable, so that the user can choose between using the kernel module or libusb, simply by a switch in /etc/cups/cupsd.conf or /etc/cups/usb.conf.
The text was updated successfully, but these errors were encountered: