hplip-avahi-parsing.patch 1.2 KB

1234567891011121314151617181920
  1. diff -up hplip-3.15.2/base/avahi.py.parsing hplip-3.15.2/base/avahi.py
  2. --- hplip-3.15.2/base/avahi.py.parsing 2015-02-04 15:43:37.662551377 +0100
  3. +++ hplip-3.15.2/base/avahi.py 2015-02-04 15:45:56.576564858 +0100
  4. @@ -52,9 +52,14 @@ def detectNetworkDevices(ttl=4, timeout=
  5. 'status_code': 0, 'device2': '0', 'device3': '0', 'note': ''}
  6. y['ip'] = ip
  7. y['hn'] = bits[6].replace('.local', '')
  8. - details = bits[9].split('" "')
  9. + details = bits[9].rstrip ().strip ('"').split('" "')
  10. for item in details:
  11. key, value = item.split('=', 1)
  12. + keyvalue = item.split('=', 1)
  13. + if len (keyvalue) < 2:
  14. + # Skip parts that don't match key=value
  15. + continue
  16. + key, value = keyvalue
  17. if key == 'ty':
  18. y['mdns'] = value
  19. y['device1'] = "MFG:Hewlett-Packard;MDL:%s;CLS:PRINTER;" % value