[cups-devel] Hacking USB uris to make them more predictableJustin Carlson

foozle at gmail.com
Wed Feb 22 11:39:35 PST 2017


So I'm working with cups to handle USB printing in a managed system, and,
for reasons that probably aren't particularly interesting to this list, I'd
like to be able to directly query a USB printer and reliably determine the
URI that cups is going to use to refer to that device, preferably without
having to call out to any CUPS binaries/libraries.

Having dug through the code a bit, the number of hacks/workarounds/fuzzy
matching stuff that is currently done during URI generation to cope with
weirdness and inconsistencies in the ieee1284 fields makes me deeply
uncomfortable -- it seems like matching those special cases and munges
would end up extremely fragile.

However, URI generation for USB devices seems to be extremely well
localized -- AFAICT it's just in make_device_uri() in backend/usb-libusb.c.


So I'm thinking, at least for our system, of patching CUPS to use a
completely different USB URI scheme that ignores the ieee1284 fields
altogether in favor of using things in the USB device descriptor --
probably something like usb://{vendor_id}/{product_id}?serial={serial}.

These URIs are not really user-visible in my use case, so I'm just
concerned about having a reliable reference to a given printer.

Is this a terrible idea for some reason that I'm not seeing?  Are there
subtle dependencies on the existing URI scheme of which I may not be
aware?  Happy to get any feedback at all on this.

Thanks,
-J


More information about the cups-devel mailing list