[cups.development] [RFE] STR #3357: One "usb" CUPS backend for both libusb-based and usblp-based access

Till Kamppeter till.kamppeter at gmail.com
Wed Sep 30 06:27:13 PDT 2009


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

On Linux (and perhaps some other Unixes), the "usb" backend can currently
be either compiled to access the printers through the "usblp" kernel
module (/dev/usb/lp*) or through libusb (low-level USB), but one cannot
have one backend which uses both access methods.

This causes a problem when transferring Linux distributions from the use
of the kernel module to the use of libusb. Reasons why to switch libusb
are:

1. HPLIP (and soon perhaps more manufacturer-supplied backends) is
libusb-based, it grabs the device and takes it away from the usblip-based
usb backend of. This causes some confusion, especially the UDEV scripts
must always check both the low-level signals and the usblp signals coming
from the printer to reliably determine when a printer appears and when it
disappears.

2. The usblp-based backend disables bi-di access for several important
manufacturers, as usblp does not work with most printers of them.

3. The libusb-based backend supports also some more general access, for
example to allow printing and non-printing functions on an MF device to be
done in parallel. This allows to drop many manufacturer-supplied CUPS
backends in the future.

4. The possibility to get the serial number from every printer, even if
the device ID does not contain it.

Problems of the switchover are caused by the absence of the usblp kernel
module, for example printer firmware upload through /dev/usb/lp*, ecputil,
libinklevel, ... Also URIs have changed and so printers created with the
usb backend of CUPS 1.3.x will not work with the new 1ibusb-based backend.

The attached patch make one "usb" backend out of the two. This new backend

- Uses both access methods: libusb and the usblp kernel module
- Discovers always all printers independent which ones are attached to the
kernel module and which ones has to get accessed directly through libusb
- Algorithms to generate the make and model part of the URIs are identical
now for both access methods, serial number and interface is added to the
URI if available
- As an URI determined via libusb can have additional serial number and
interface parts the URI matching for printing a file is made more tolerant
now. URIs which only differ by the presence of an interface part or URIs
with and without serial number are considered equal. So on a printer
discovered through the usblp module one can print when the kernel module
is detached or not loaded. This is especially important for print queues
which were created with CUPS 1.3.x or older. They simply keep working now,
even when unloading the kernel module.
- Linux distributions will have the possibility to let the user work with
or without usblp kernel module, without needing two different CUPS
packages.

The attached patch is done in a somehow minimum invasive way, keeping the
changes small. Probably one can simplify the code. It was also not tested
whether whether it works with all possibilities of conditional compiling.
I have tested on both the HP LaserJet 3390 and the HP PhotoSmart C8100. On
both printers one can print with and without "usblp" loaded and without
needing to re-create the print queues.

The patch is for CUPS 1.4.1.

Link: http://www.cups.org/str.php?L3357
Version:  -feature
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: usb-backend-both-usblp-and-libusb.patch
URL: <https://lists.cups.org/pipermail/cups/attachments/20090930/a0139b1b/attachment.ksh>


More information about the cups mailing list