https://bugs.kde.org/show_bug.cgi?id=517521

            Bug ID: 517521
           Summary: USB printer not shown in "Local Printers" when also
                    discoverable on the network
    Classification: Applications
           Product: systemsettings
      Version First 6.5.5
       Reported In:
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: kcm_printer_manager
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
  Target Milestone: ---

# USB printer not shown in "Local Printers" when also discoverable on the
network

## Summary

When a USB-connected printer is also visible on the network (via dnssd/IPP), it
does not appear in the "Local Printers" section of the KCM. The USB connection
option is completely inaccessible through the UI.

## Steps to reproduce

1. Connect a printer via USB that also has network connectivity (e.g. Pantum
P3300DN with both USB and Wi-Fi/Ethernet)
2. Open System Settings → Printers → Add Printer
3. Observe that the printer appears only under "Discovered Network Printers"
4. Click on the printer entry — only the network connection (dnssd/ipps) is
offered, with no option to use USB

## Expected behavior

The printer should appear in "Local Printers" with USB as the primary
connection, and network URIs available as alternatives in the connection list
(`Direct.qml`).

## Actual behavior

The printer appears only in "Discovered Network Printers". Clicking it loads
`Network.qml`, which uses a single network URI and ignores the `device-uris`
list entirely. The USB connection is unreachable.

## Root cause

`DevicesModel::finished()` takes the first URI from each group returned by
`GroupPhysicalDevices()` D-Bus call and uses its `device_class` to determine
the category:

```cpp
const QString uri = list.first();
const MapSS device = m_mappedDevices[uri];
insertDevice(device[KCUPS_DEVICE_CLASS], ...);
```

`GroupPhysicalDevices()` (from system-config-printer) groups the USB and
network URIs of the same physical device together but does not guarantee that
local URIs come first. In practice, network URIs (dnssd://, ipps://) sort
before usb:// and end up first in the group. This causes `device_class =
"network"`, placing the entire group in the Network section.

Additionally, `Network.qml` only uses the single primary `device-uri` and does
not expose `device-uris`, so even the alternative USB URI stored in the group
is inaccessible.

## Environment

- print-manager 6.5.6
- CUPS with USB and dnssd backends
- system-config-printer providing `GroupPhysicalDevices()` D-Bus service
- Tested with Pantum P3300DN (USB + network)

## Debug log (relevant excerpt)

CUPS correctly returns the USB device:

```
device_class: "direct"
device_id:    "MFG:Pantum;CMD:ACL,PJL,PL,PCL,PCLXL,PS3,PDF;MDL:P3300DN
series;..."
device_uri:   "usb://Pantum/P3300DN%20series?serial=CC6Q011725"
```

But the same printer is also found via network:

```
device_class: "network"
device_uri:   "dnssd://Pantum%20P3300DN%20Series%20181F49._ipp._tcp.local/..."

device_class: "network"
device_uri:   "ipps://Pantum%20P3300DN%20Series%20181F49._ipps._tcp.local/"
```

After `GroupPhysicalDevices()`, the network URI becomes the primary one and the
printer is categorized as network-only.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to