rpms/hal-cups-utils/devel hal-cups-utils-hplip.patch, NONE, 1.1 hal-cups-utils.spec, 1.47, 1.48

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sun Dec 17 19:05:40 UTC 2006


Author: twaugh

Update of /cvs/dist/rpms/hal-cups-utils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20870

Modified Files:
	hal-cups-utils.spec 
Added Files:
	hal-cups-utils-hplip.patch 
Log Message:
* Sun Dec 17 2006 Tim Waugh <twaugh at redhat.com>
- Use 'hp:' URIs when appropriate (bug #175555).
- Resolves: rhbz#175555


hal-cups-utils-hplip.patch:
 hal_lpadmin |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

--- NEW FILE hal-cups-utils-hplip.patch ---
--- hal-cups-utils-0.6.2/systemv/hal_lpadmin.hplip	2006-12-17 19:03:51.000000000 +0000
+++ hal-cups-utils-0.6.2/systemv/hal_lpadmin	2006-12-17 19:04:12.000000000 +0000
@@ -8,6 +8,7 @@
 class HalPrinter:
     def __init__(self):
         self.get_properties()
+        self.uris = None
         try:
             self.cups_connection = cups.Connection()
         except RuntimeError:
@@ -44,11 +45,34 @@
         return name.replace("#", "_")
 
     def get_cups_uris(self):
-        return ["hal://%s" % self.uid,
-                ]
+        if self.uris != None:
+            return self.uris
+        uris=["hal://%s" % self.uid]
+        if (self.properties.has_key("printer.vendor") and
+            self.properties.has_key("printer.serial")):
+            vendor = self.properties["printer.vendor"].lower ()
+            if vendor == "hewlett-packard" or vendor == "hp":
+                # Perhaps HPLIP can drive this device.  If so, we
+                # should use an 'hp:...' URI for CUPS.
+                try:
+                    devices = cupshelpers.getDevices (self.cups_connection)
+                    for uri in devices.keys ():
+                        if not uri.startswith ("hp:"): continue
+                        s = uri.find ("?serial=")
+                        if s == -1: continue
+                        s += 8
+                        e = uri[s:].find ("?")
+                        if e == -1: e = len (uri)
+                        serial = uri[s:e]
+                        if serial == self.properties["printer.serial"]:
+                           uris.insert (0, uri)
+                except:
+                    pass
+        self.uris = uris
+        return uris
 
     def get_cups_uri(self):
-        return "hal://%s" % self.uid
+        return self.get_cups_uris()[0]
 
     def match(self, printer):
         if printer.is_class: return False


Index: hal-cups-utils.spec
===================================================================
RCS file: /cvs/dist/rpms/hal-cups-utils/devel/hal-cups-utils.spec,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- hal-cups-utils.spec	17 Dec 2006 15:25:39 -0000	1.47
+++ hal-cups-utils.spec	17 Dec 2006 19:05:37 -0000	1.48
@@ -13,6 +13,7 @@
 Patch4: hal-cups-utils-match-commandset.patch
 Patch5: hal-cups-utils-ieee1284.patch
 Patch6: hal-cups-utils-syslog.patch
+Patch7: hal-cups-utils-hplip.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: glib2-devel
 BuildRequires: dbus-devel >= 0.60
@@ -42,6 +43,7 @@
 %patch4 -p0 -b .match-commandset
 %patch5 -p1 -b .ieee1284
 %patch6 -p1 -b .syslog
+%patch7 -p1 -b .hplip
 
 %build
 
@@ -78,6 +80,7 @@
 
 %changelog
 * Sun Dec 17 2006 Tim Waugh <twaugh at redhat.com>
+- Use 'hp:' URIs when appropriate (bug #175555).
 - Added syslogging to hal_lpadmin.
 
 * Thu Nov  9 2006 Tim Waugh <twaugh at redhat.com> - 0.6.2-7




More information about the fedora-cvs-commits mailing list