rpms/cups/F-13 cups-snmp-quirks.patch,NONE,1.1 cups.spec,1.593,1.594

Tim Waugh twaugh at fedoraproject.org
Tue Apr 13 11:22:19 UTC 2010


Author: twaugh

Update of /cvs/pkgs/rpms/cups/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv6575

Modified Files:
	cups.spec 
Added Files:
	cups-snmp-quirks.patch 
Log Message:
* Tue Apr 13 2010 Tim Waugh <twaugh at redhat.com> 1:1.4.3-3
- Handle SNMP supply level quirks (bug #581825).


cups-snmp-quirks.patch:
 snmp-supplies.c |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- NEW FILE cups-snmp-quirks.patch ---
diff -up cups-1.4.3/backend/snmp-supplies.c.snmp-quirks cups-1.4.3/backend/snmp-supplies.c
--- cups-1.4.3/backend/snmp-supplies.c.snmp-quirks	2009-11-20 01:27:57.000000000 +0000
+++ cups-1.4.3/backend/snmp-supplies.c	2010-04-13 11:54:13.508023630 +0100
@@ -38,6 +38,15 @@
 
 
 /*
+ * Printer quirks...
+ */
+
+/* The prtMarkerSuppliesLevel values are percentages, not levels
+ * relative to the stated capacity. */
+#define QUIRK_LEVEL_IS_PERCENTAGE	(1<<0)
+
+
+/*
  * Local structures...
  */
 
@@ -57,6 +66,12 @@ typedef struct				/**** Printer state ta
   const char	*keyword;		/* IPP printer-state-reasons keyword */
 } backend_state_t;
 
+typedef struct				/**** Printer quirk table ****/
+{
+  const char	*description;		/* hrDeviceDescr */
+  int		quirks;			/* quirks (bitmask) */
+} printer_quirk_t;
+
 
 /*
  * Local globals...
@@ -68,6 +83,7 @@ static int		current_state = -1;
 static int		charset = -1;	/* Character set for supply names */
 static int		num_supplies = 0;
 					/* Number of supplies found */
+static int		quirks = 0;	/* Printer quirks */
 static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
 					/* Supply information */
 
@@ -153,6 +169,11 @@ static const backend_state_t const print
 			  { CUPS_TC_outputFull, "output-area-full-warning" }
 			};
 
+static const printer_quirk_t const printer_quirks[] =
+			{
+			  { "Officejet Pro 8500 A909g", QUIRK_LEVEL_IS_PERCENTAGE }
+			};
+
 
 /*
  * Local functions...
@@ -208,6 +229,9 @@ backendSNMPSupplies(
       if (i)
         *ptr++ = ',';
 
+      if (quirks & QUIRK_LEVEL_IS_PERCENTAGE)
+	supplies[i].max_capacity = 100;
+
       if (supplies[i].max_capacity > 0)
         sprintf(ptr, "%d", 100 * supplies[i].level / supplies[i].max_capacity);
       else
@@ -366,6 +390,7 @@ backend_init_supplies(
   current_state = -1;
   num_supplies  = -1;
   charset       = -1;
+  quirks	= 0;
 
   memset(supplies, 0, sizeof(supplies));
 
@@ -404,6 +429,15 @@ backend_init_supplies(
 
   fprintf(stderr, "DEBUG2: hrDeviceDesc=\"%s\"\n", description);
 
+  for (i = 0; i < sizeof (printer_quirks) / sizeof (printer_quirks[0]); i++)
+  {
+    if (!strcmp (description, printer_quirks[i].description))
+    {
+      quirks = printer_quirks[i].quirks;
+      break;
+    }
+  }
+
  /*
   * See if we have already queried this device...
   */


Index: cups.spec
===================================================================
RCS file: /cvs/pkgs/rpms/cups/F-13/cups.spec,v
retrieving revision 1.593
retrieving revision 1.594
diff -u -p -r1.593 -r1.594
--- cups.spec	31 Mar 2010 16:08:39 -0000	1.593
+++ cups.spec	13 Apr 2010 11:22:19 -0000	1.594
@@ -8,7 +8,7 @@
 Summary: Common Unix Printing System
 Name: cups
 Version: 1.4.3
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@@ -63,6 +63,7 @@ Patch29: cups-0755.patch
 Patch30: cups-EAI_AGAIN.patch
 Patch31: cups-str3505.patch
 Patch32: cups-str3541.patch
+Patch33: cups-snmp-quirks.patch
 
 Patch100: cups-lspp.patch
 
@@ -262,6 +263,7 @@ module. 
 %patch31 -p1 -b .str3505
 # Fix lpstat to adhere to -o option.
 %patch32 -p1 -b .str3541
+%patch33 -p1 -b .snmp-quirks
 
 %if %lspp
 # LSPP support.
@@ -562,6 +564,9 @@ rm -rf $RPM_BUILD_ROOT
 %{php_extdir}/phpcups.so
 
 %changelog
+* Tue Apr 13 2010 Tim Waugh <twaugh at redhat.com> 1:1.4.3-3
+- Handle SNMP supply level quirks (bug #581825).
+
 * Wed Mar 31 2010 Tim Waugh <twaugh at redhat.com> 1:1.4.3-2
 - Another BrowsePoll fix: handle EAI_NODATA as well (bug #567353).
 



More information about the scm-commits mailing list