rpms/hal-cups-utils/FC-6 hal-cups-utils-ieee1284.patch, NONE, 1.1 hal-cups-utils.spec, 1.44, 1.45

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Nov 9 11:29:46 UTC 2006


Author: twaugh

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

Modified Files:
	hal-cups-utils.spec 
Added Files:
	hal-cups-utils-ieee1284.patch 
Log Message:
* Thu Nov  9 2006 Tim Waugh <twaugh at redhat.com> - 0.6.2-4.2
- IEEE 1284 Device ID in CUPS backend (bug #214755).
- Resolves: rhbz#214755


hal-cups-utils-ieee1284.patch:
 hal.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 3 deletions(-)

--- NEW FILE hal-cups-utils-ieee1284.patch ---
--- hal-cups-utils-0.6.2/backend/hal.c.ieee1284	2006-01-11 23:20:05.000000000 +0000
+++ hal-cups-utils-0.6.2/backend/hal.c	2006-11-09 11:04:11.000000000 +0000
@@ -106,8 +106,11 @@
 		printf("direct hal \"Unknown\" \"Hal printing backend\"\n"); 
 
 	for (i = 0; i < num_printers; i++) {
-		const char *vendor, *product, *description;
+		const char *vendor, *product, *description,
+			*commandset, *serial;
 		char make_model[1024];
+		char deviceid[4000], *dp;
+		size_t dlen;
 
 		/* We only want printers that have device nodes */
 		if (!libhal_device_property_exists (hal_ctx, printer_list[i],
@@ -129,6 +132,16 @@
 							         "printer.description",
 								 NULL);
 
+		commandset = libhal_device_get_property_string (hal_ctx,
+								printer_list[i],
+								"printer.commandset",
+								NULL);
+
+		serial = libhal_device_get_property_string (hal_ctx,
+							    printer_list[i],
+							    "printer.serial",
+							    NULL);
+
 		/* Try our hardest to get a good name */
 		if (product != NULL) {
 			if (vendor != NULL) {
@@ -147,9 +160,45 @@
 			strncpy (make_model, "Unknown", sizeof (make_model));
 		}
 
-		printf ("direct hal://%s \"%s\" \"%s\"\n",
+		/* Reconstruct the Device ID. */
+		deviceid[0] = '\0';
+		dp = deviceid;
+		dlen = sizeof (deviceid) - 1;
+		if (vendor != NULL) {
+			int l = snprintf (dp, dlen, "MFG:%s;", vendor);
+			dlen -= l;
+			dp += l;
+		}
+		if (product != NULL) {
+			int l = snprintf (dp, dlen, "MDL:%s;", product);
+			dlen -= l;
+			dp += l;
+		}
+		if (commandset != NULL) {
+			int l = snprintf (dp, dlen, "CMD:%s;", commandset);
+			dlen -= l;
+			dp += l;
+		}
+		snprintf (dp, dlen, "CLS:PRINTER;");
+		dlen -= 12;
+		dp += 12;
+		if (serial != NULL) {
+			int l = snprintf (dp, dlen, "SN:%s;", serial);
+			dlen -= l;
+			dp += l;
+		}
+		/* Replace double-quotes with single quotes. */
+		dp = deviceid;
+		while (*dp != '\0') {
+			if (*dp == '"')
+				*dp = '\'';
+			dp++;
+		}
+
+		printf ("direct hal://%s \"%s\" \"%s\" \"%s\"\n",
 			printer_list[i], make_model,
-			description != NULL ? description : make_model);
+			description != NULL ? description : make_model,
+			deviceid);
 	}
 
 	dbus_error_init (&error);


Index: hal-cups-utils.spec
===================================================================
RCS file: /cvs/dist/rpms/hal-cups-utils/FC-6/hal-cups-utils.spec,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- hal-cups-utils.spec	8 Nov 2006 18:05:59 -0000	1.44
+++ hal-cups-utils.spec	9 Nov 2006 11:29:44 -0000	1.45
@@ -1,7 +1,7 @@
 Summary: Halified CUPS utilities 
 Name: hal-cups-utils
 Version: 0.6.2
-Release: 4.1
+Release: 4.2
 License: GPL
 Group: Applications/System
 Source: %{name}-%{version}.tar.gz
@@ -11,6 +11,7 @@
 Patch2: hal-cups-utils-api-name.patch
 Patch3: hal-cups-utils-introspection.patch
 Patch4: hal-cups-utils-match-commandset.patch
+Patch5: hal-cups-utils-ieee1284.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildRequires: glib2-devel
 BuildRequires: dbus-devel >= 0.60
@@ -38,6 +39,7 @@
 %patch2 -p1 -b .api-name
 %patch3 -p1 -b .introspection
 %patch4 -p0 -b .match-commandset
+%patch5 -p1 -b .ieee1284
 
 %build
 
@@ -73,6 +75,9 @@
 %{_initrddir}/cups-config-daemon
 
 %changelog
+* Thu Nov  9 2006 Tim Waugh <twaugh at redhat.com> - 0.6.2-4.2
+- IEEE 1284 Device ID in CUPS backend (bug #214755).
+
 * Wed Nov  8 2006 Tim Waugh <twaugh at redhat.com> - 0.6.2-4.1
 - Use printer.commandset when matching printers (bug #214180).
 - Fixed HAL printer interface API name (bug #214598).




More information about the fedora-cvs-commits mailing list