Files
hplip/hplip-fix-driver-probing-using-avahi.patch
Johannes Meixner 497ec9ee78 - Move more utilities from hplip-utils to hplip-base.
* hplip-base now contains all utilities that are not totally useless
    and can run without the Qt GUI.

- Update fix for support of new GPG key, as the key has now been
  uploaded to GPG keyservers (lp#2120738)
  * drop hplip-hardcode-new-signing-key-AC69536A2CF3A243.patch
  * update hplip-change-pgp-server.patch

- Drop dependency on cups-ppdc. It isn't necessary, as PPD
  generation on target system is done by cups-driverd.

- The old and outdated 'hpijs' driver support is finally dropped
  (the 'hpcups' driver is the default driver since 2009)
  so that there is no need for foomatic-filters (boo#1250481)

- Continue refactoring:
  * move GUI tools to "hplip-utils" subpackage
  * convert "hplip" into an empty metapackage that pulls in hplip-utils 
    and all drivers / PPDs (except hpijs PPDs).

- Refactor package structure:
  * hplip: full set of utilities. Pulls in almost all subpackages
    to deliver the "traditional" hplip experience
  * hplip-base: small set of basic utilities that can be run
    without GUI. Includes hp-probe and hp-plugin
  * hplip-cups: minimal package for printing, without PPDs or
    setup helpers
  * hplip-sane: scanning support (unchanged) 
  * hplip-driver-hpcups: hpcups.drv for generating hpcups PPDs on
    the fly (requires ppdc). The functionality of this package is
    similar to the old (misnamed) "hplip-hpijs" package.
  * hplip-driver-hpijs: hpijs.drv for generating PPDs for the deprecated
    hpijs / foomatic_rip filter. Note that this functionality was not part of
    the late hplip-hpijs package, because upstream hasn't ship foomatic PPDs
    since hplip 3.17.11.
  * hplip-ppds-{hpcups,hpps,postscript,hpijs,fax,plugin}: static PPD
    files for different printer types.
    hplip-ppds-hpcups is an alternative to hplip-driver-hpcups.
  * libhplip0: shared library package, used by hplip-cups and
    hplip-sane
  * hplip-common: configuration files and directories used by
    all hplip packages.
- Other spec file changes:
  * Skip deprecated suse_update_desktop_file by default on TW
  * Don't mess with sane configuration in udev rules
  * Only the hpijs packages depend on foomatic-rip, which is only
    provided by cups-filters-1.x. The other packages can be used
    with cups-filters2.
  * Remove Obsoletes: for ancient predecessor packages
  * Remove outdated comments from spec file
  * Shorten package descriptions
  * Fix a couple of rpmlint issues
    
- Fix printer probing using avahi (lp#2120947)
  * Add hplip-fix-driver-probing-using-avahi.patch
  * Add hplip-fix-python-crash-in-avahi.py.patch

OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=275
2025-10-09 08:17:23 +00:00

63 lines
2.6 KiB
Diff

From d68d0748c4493ef3192e4f59756ece2bd2fbb004 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 19 Aug 2025 12:06:17 +0200
Subject: [PATCH] hplip: fix driver probing using avahi
- _printer._tcp doesn't work for my printer (HP Smart Tank 7300 series).
mdns.py uses _pdl-datastream._tcp, which works.
- my printer sends `usb_MDL` property, which mdns.py accepts as alternative
for `ty`.
- "bonjour" search protocol exists nowhere else in the code. "avahi" does.
---
base/avahi.py | 8 ++++++--
probe.py | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/base/avahi.py b/base/avahi.py
index 51795dd..b82a089 100755
--- a/base/avahi.py
+++ b/base/avahi.py
@@ -37,6 +37,9 @@ def detectNetworkDevices(ttl=4, timeout=10):
# Obtain all the resolved services which has service type '_printer._tcp' from avahi-browse
p = Popen(['avahi-browse', '-kprt', '_printer._tcp'], stdout=PIPE)
output = to_string_utf8(p.communicate()[0])
+ p = Popen(['avahi-browse', '-kprt', '_pdl-datastream._tcp'], stdout=PIPE)
+ output += to_string_utf8(p.communicate()[0])
+
for line in output.splitlines():
if line.startswith('='):
bits = line.split(';')
@@ -55,11 +58,12 @@ def detectNetworkDevices(ttl=4, timeout=10):
details = bits[9].split('" "')
for item in details:
key, value = item.split('=', 1)
- if key == 'ty':
+ if key == 'ty' or key == 'usb_MDL':
y['mdns'] = value
y['device1'] = "MFG:Hewlett-Packard;MDL:%s;CLS:PRINTER;" % value
break
- found_devices[y['ip']] = y
+ if y['ip'] not in found_devices:
+ found_devices[y['ip']] = y
#log.debug("ip=%s hn=%s ty=%s" %(ip,y['hn'], y['mdns']))
except socket.gaierror:
pass
diff --git a/probe.py b/probe.py
index 82e5de9..3bf3ba8 100755
--- a/probe.py
+++ b/probe.py
@@ -93,8 +93,8 @@ try:
elif o in ('-m', '--method'):
method = a.lower().strip()
- if method not in ('slp', 'mdns', 'bonjour'):
- mod.usage(error_msg=["Invalid network search protocol name. Must be 'slp' or 'mdns'."])
+ if method not in ('slp', 'mdns', 'avahi'):
+ mod.usage(error_msg=["Invalid network search protocol name. Must be 'slp', 'mdns', or 'avahi'."])
else:
bus = ['net']
--
2.50.1