hplip/hplip-avahi-parsing.patch

20 lines
1.1 KiB
Diff

diff -up hplip-3.14.6/base/avahi.py.avahi-parsing hplip-3.14.6/base/avahi.py
--- hplip-3.14.6/base/avahi.py.avahi-parsing 2014-06-17 14:42:57.557586402 +0100
+++ hplip-3.14.6/base/avahi.py 2014-06-17 14:45:56.104509934 +0100
@@ -59,9 +59,13 @@ def detectNetworkDevices(ttl=4, timeout=
'status_code': 0, 'device2': '0', 'device3': '0', 'note': ''}
y['ip'] = ip
y['hn'] = bits[6].replace('.local', '')
- details = bits[9].split('" "')
+ details = bits[9].rstrip ().strip ('"').split('" "')
for item in details:
- key, value = item.split('=', 1)
+ keyvalue = item.split('=', 1)
+ if len (keyvalue) < 2:
+ # Skip parts that don't match key=value
+ continue
+ key, value = keyvalue
if key == 'ty':
y['mdns'] = value
y['device1'] = "MFG:Hewlett-Packard;MDL:%s;CLS:PRINTER;" % value