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

Solomon Peachy pizza at shaftnet.org
Wed Feb 22 16:31:49 PST 2017

On Wed, Feb 22, 2017 at 09:49:41PM +0000, Justin Carlson wrote:
> Do you have any sense for whether 'serial-number-is-bogus' is reliably
> detectable across manufacturers?  Like, people leave it a zero-length
> field, or set to all zeros, or similar?  No device manufacturer would do
> something like set the same non-zero serial number for all devices, would
> they?  Would They?

Unfortunately, it is absolutely unreliably unreliable.

I have a printer here made by a major (non-conusumer) manufacturer that 
has a valid serial number that matches the sticker on the side.  I've 
seen two other examples of this same model that have a serial number of 

I've seen them with null strings, all 0s, equal non-null, and seemingly 
unique but not even remotely matching any labels on the device or 
packaging.  I've also seen them report badness via the USB (or IEEE1284) 
descriptors but provide a vendor-specific mechanism to query the real 
serial number.

(...so as hairy as the CUPS usb backend is, the one I wrote for
 various dyesub models supported by Gutenprint is all that, and worse.  :)

I started down the path you did, using USB topology info when the serial 
number was unknown.. only to give up as the cure turned out to be worse 
than the disease...

In all seriousness, your best bet will probably be, at startup, to call 
the usb backend without any arguments, as that'll give you the URIs of 
all printers that can be detected.


 - Solomon
Solomon Peachy			       pizza at shaftnet dot org
Delray Beach, FL                          ^^ (email/xmpp) ^^
Quidquid latine dictum sit, altum videtur.

More information about the cups mailing list