rpms/cups/F-13 cups-snmp-quirks.patch,1.1,1.2 cups.spec,1.601,1.602

Tim Waugh twaugh at fedoraproject.org
Wed Jun 9 15:52:18 UTC 2010


Author: twaugh

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

Modified Files:
	cups-snmp-quirks.patch cups.spec 
Log Message:
* Wed Jun  9 2010 Tim Waugh <twaugh at redhat.com> 1:1.4.3-11
- Use upstream method of handling SNMP quirks in PPDs (STR #3551,
  bug #581825).


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

Index: cups-snmp-quirks.patch
===================================================================
RCS file: /cvs/pkgs/rpms/cups/F-13/cups-snmp-quirks.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- cups-snmp-quirks.patch	13 Apr 2010 11:22:18 -0000	1.1
+++ cups-snmp-quirks.patch	9 Jun 2010 15:52:17 -0000	1.2
@@ -1,36 +1,34 @@
 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 @@
++++ cups-1.4.3/backend/snmp-supplies.c	2010-06-09 16:27:05.515019804 +0100
+@@ -38,6 +38,13 @@
  
  
  /*
 + * Printer quirks...
 + */
 +
-+/* The prtMarkerSuppliesLevel values are percentages, not levels
-+ * relative to the stated capacity. */
-+#define QUIRK_LEVEL_IS_PERCENTAGE	(1<<0)
++#define QUIRK_CAPACITY	(1<<0)
 +
 +
 +/*
   * Local structures...
   */
  
-@@ -57,6 +66,12 @@ typedef struct				/**** Printer state ta
+@@ -57,6 +64,12 @@ typedef struct				/**** Printer state ta
    const char	*keyword;		/* IPP printer-state-reasons keyword */
  } backend_state_t;
  
-+typedef struct				/**** Printer quirk table ****/
++typedef struct				/**** Quirk names table ****/
 +{
-+  const char	*description;		/* hrDeviceDescr */
-+  int		quirks;			/* quirks (bitmask) */
-+} printer_quirk_t;
++  int		bit;			/* Quirk bit */
++  const char	*keyword;		/* cupsSNMPQuirks keyword */
++} quirk_name_t;
 +
  
  /*
   * Local globals...
-@@ -68,6 +83,7 @@ static int		current_state = -1;
+@@ -68,6 +81,7 @@ static int		current_state = -1;
  static int		charset = -1;	/* Character set for supply names */
  static int		num_supplies = 0;
  					/* Number of supplies found */
@@ -38,29 +36,41 @@ diff -up cups-1.4.3/backend/snmp-supplie
  static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
  					/* Supply information */
  
-@@ -153,6 +169,11 @@ static const backend_state_t const print
+@@ -153,6 +167,15 @@ static const backend_state_t const print
  			  { CUPS_TC_outputFull, "output-area-full-warning" }
  			};
  
-+static const printer_quirk_t const printer_quirks[] =
++static const quirk_name_t const quirk_names[] =
 +			{
-+			  { "Officejet Pro 8500 A909g", QUIRK_LEVEL_IS_PERCENTAGE }
++			 /*
++			  * The prtMarkerSuppliesLevel values are
++			  * percentages, not levels relative to the
++			  * stated capacity.
++			  */
++			  { QUIRK_CAPACITY, "capacity" }
 +			};
-+
  
  /*
   * Local functions...
-@@ -208,6 +229,9 @@ backendSNMPSupplies(
+@@ -208,6 +231,9 @@ backendSNMPSupplies(
        if (i)
          *ptr++ = ',';
  
-+      if (quirks & QUIRK_LEVEL_IS_PERCENTAGE)
++      if (quirks & QUIRK_CAPACITY)
 +	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(
+@@ -305,6 +331,7 @@ backend_init_supplies(
+     http_addr_t *addr)			/* I - Printer address */
+ {
+   int		i,			/* Looping var */
++		len,			/* Quirk name length */
+ 		type;			/* Current marker type */
+   cups_file_t	*cachefile;		/* Cache file */
+   const char	*cachedir;		/* CUPS_CACHEDIR value */
+@@ -366,6 +393,7 @@ backend_init_supplies(
    current_state = -1;
    num_supplies  = -1;
    charset       = -1;
@@ -68,19 +78,38 @@ diff -up cups-1.4.3/backend/snmp-supplie
  
    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++)
+@@ -381,6 +409,34 @@ backend_init_supplies(
+     return;
+   }
+ 
++  if (ppd &&
++      (ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL &&
++      ppdattr->value)
 +  {
-+    if (!strcmp (description, printer_quirks[i].description))
++    ptr = ppdattr->value;
++    while (*ptr != '\0')
 +    {
-+      quirks = printer_quirks[i].quirks;
-+      break;
++     /*
++      * Match keyword against quirk_names table.
++      */
++
++      for (i = 0; i < sizeof (quirk_names) / sizeof (quirk_names[0]); i++)
++      {
++	len = strlen (quirk_names[i].keyword);
++	if (!strncmp (value, quirk_names[i].keyword, len) &&
++	    (value[len] == '\0' || value[len] == ' '))
++	  quirks |= quirk_names[i].bit;
++      }
++
++     /*
++      * Advance to next keyword.
++      */
++
++      ptr += strcspn (ptr, " ");
++      ptr += strspn (ptr, " ");
 +    }
 +  }
 +
+   ppdClose(ppd);
+ 
   /*
-   * 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.601
retrieving revision 1.602
diff -u -p -r1.601 -r1.602
--- cups.spec	1 Jun 2010 15:34:26 -0000	1.601
+++ cups.spec	9 Jun 2010 15:52:18 -0000	1.602
@@ -8,7 +8,7 @@
 Summary: Common Unix Printing System
 Name: cups
 Version: 1.4.3
-Release: 10%{?dist}
+Release: 11%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@@ -582,6 +582,10 @@ rm -rf $RPM_BUILD_ROOT
 %{php_extdir}/phpcups.so
 
 %changelog
+* Wed Jun  9 2010 Tim Waugh <twaugh at redhat.com> 1:1.4.3-11
+- Use upstream method of handling SNMP quirks in PPDs (STR #3551,
+  bug #581825).
+
 * Tue Jun 01 2010 Jiri Popelka <jpopelka at redhat.com> 1:1.4.3-10
 - Added back still useful str3425.patch.
   Second part of STR #3425 is still not fixed in 1.4.3



More information about the scm-commits mailing list