system-config-printer icon indicating copy to clipboard operation
system-config-printer copied to clipboard

Fix multi-backend handling

Open darkvision77 opened this issue 4 months ago • 0 comments

It is not possible to select another backend if it is not «whitelisted».

Example. One device, multiple backends:

% lpinfo -v
direct usb://Canon/LBP3200?serial=00000000
direct captusb://Canon/LBP3200?serial=00000000

% python3 PhysicalDevice.py
Canon LBP3200 (00000000)
  <cupshelpers.Device "usb://Canon/LBP3200?serial=00000000">
  <cupshelpers.Device "captusb://Canon/LBP3200?serial=00000000">

The backend is defined correctly, but it is not displayed in the UI.

The reason is here:

if device.type == "parallel":
    ...
elif device.type == "serial":
    ...
elif device.type == "usb":
    ...
<...>
else:
    # device.type is "captusb"
    show_uris = False

https://github.com/OpenPrinting/system-config-printer/blob/4ec8a945e03ddd769ab26f5e735808b5e69301fb/newprinter.py#L3140

So, if you have multiple backends for a device, any other non-standard backend will not be visible to the end user. The backend selection list simply won't be shown.

This patch makes the selection list visible if multiple backends are available for the device.

The selection list looks like this (with multiple backends, it's just hidden) Single backend

P.S. I just checked git blame and found that my patch literally undoes this commit: https://github.com/OpenPrinting/system-config-printer/commit/92c531cf07cfd9e416e204e6085ada242468bf97
Any thoughts on why it was done this way?

darkvision77 avatar Aug 31 '25 17:08 darkvision77