Skip to content

Improve printer discovery and device identification - #496

Open
SinghCod3r wants to merge 5 commits into
masterfrom
fix/separate-snmp-network-discovery
Open

SinghCod3r wants to merge 5 commits into
masterfrom
fix/separate-snmp-network-discovery

Conversation

@SinghCod3r

@SinghCod3r SinghCod3r commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Improve printer discovery and device identification by:

  • separating automatically discovered DNS-SD and legacy network printers in the New Printer GUI
  • correctly classifying discovered printers based on their URI
  • improving PhysicalDevice identification for driverless IPP/IP​​P-over-USB devices when CUPS provides empty MFG/MDL fields
  • preserving the existing usb_SER-based suppression of legacy USB devices when an IPP-over-USB counterpart is discovered

Changes

1. Separate DNS-SD and Legacy network printers

Network printers can be discovered through different CUPS backends and discovery mechanisms.

DNS-SD/driverless discovery normally provides symbolic service URIs, while SNMP and other legacy discovery mechanisms can provide literal IPv4/IPv6 addresses.

The New Printer GUI now separates automatically discovered network printers into:

  • Network Printer (DNS-SD)
  • Network Printer (Legacy)

The classification is based on the discovered device URI:

  • symbolic hostnames and DNS-SD service URIs → DNS-SD
  • literal IPv4/IPv6 addresses → Legacy
  • bjnp:// → Legacy
  • bluetooth:// → Legacy
  • dnssd:// / mdns:// → DNS-SD

SNMP remains enabled in automatic discovery.

This avoids treating the same printer discovery mechanisms as the same device merely because they may resolve to the same IP address.

CUPS backend identifiers such as ipp, ipps, socket, lpd, http, https, beh, etc. are also filtered out when they are returned without an actual printer URI. This prevents entries such as Unknown from appearing in the automatic discovery list.

2. Improve driverless IPP device identification

Some driverless IPP and IPP-over-USB devices are returned by CUPS with an id_dict containing empty MFG and MDL fields.

Previously this could result in an empty canonical manufacturer/model pair and poor or missing device labels.

PhysicalDevice._canonical_id() now falls back to:

  • device.make_and_model
  • device.info

when MFG/MDL do not provide usable information.

PhysicalDevice.get_info() also falls back to the original device information when no PPD/IPP translation is available.

This keeps the existing behavior for devices that already provide valid MFG/MDL information.

3. Preserve legacy USB / IPP-over-USB suppression

The existing serial-based suppression mechanism is unchanged.

When modern ipp-usb advertises:

usb_SER=<USB serial>

the existing system-config-printer discovery code can match that serial against the legacy usb:// device and suppress the duplicate legacy USB entry.

This was verified end-to-end using the Xerox B235 go-mfp simulator.

With:

Legacy USB serial:
34004H030206H

DNS-SD usb_SER:
34004H030206H

the New Printer GUI displayed only:

Xerox(R) B235 MFP

and the legacy:

Xerox B235 MFP (34004H030206H)

was suppressed.

The duplicate seen with Ubuntu's ipp-usb 0.9.24 was caused by that version not advertising usb_SER. No workaround or additional matching logic was added to system-config-printer.

Tests

Targeted test suite:

pytest -q tests/test_newprinter.py tests/test_PhysicalDevice.py tests/test_dnssdresolve.py tests/test_options.py

Result:

194 passed, 0 failed

Additional checks:

git diff --check

Result:

clean

The tests cover:

  • fallback identification when MFG/MDL are empty
  • fallback device information when no translation is available
  • asynchronous legacy USB + IPP-over-USB discovery using matching usb_SER
  • actual production add_devices() / ipp_usb_serials() / suppression behavior
  • DNS-SD vs Legacy URI classification
  • literal IPv4 and IPv6 classification
  • BJNP and Bluetooth legacy classification
  • filtering of bare CUPS backend identifiers

Scope

The changes intentionally do not:

  • introduce IP-based physical-device matching
  • perform model-only USB suppression
  • parse /var/ipp-usb/dev/*.state
  • change the existing usb_SER suppression architecture
  • modify dnssdresolve.py unnecessarily
  • change the production USB suppression logic

The goal is to keep printer discovery predictable and avoid duplicate or misleading entries while making driverless device identification more robust.

@SinghCod3r SinghCod3r changed the title Fix duplicate network printer discovery Improve printer discovery and device identification Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant