]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 6 Jul 2003 20:20:29 +0000 (20:20 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Sun, 6 Jul 2003 20:20:29 +0000 (20:20 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@3788 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
backend/usb.c

index 78d5cc061bbcc900801ea1af0bd2c50f6f957b99..8ac533532f28e330683e206b00b2b0d51b75d34b 100644 (file)
@@ -3,6 +3,9 @@ CHANGES-1.1.txt
 
 CHANGES IN CUPS V1.1.20rc1
 
+       - The USB backend now uses the manufacturer and model
+         strings if the description string is not available
+         (STR #174)
        - The ppdOpen functions still supported the
          VariablePaperSize attribute, which was removed in v4.0
          of the PPD spec.  This caused problems with PPD files
index fc660c01e31b2f9b81017a3ecdbf0c19d3204596..7fb3c9e3aec0e35bae994314aff490761768360c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: usb.c,v 1.18.2.24 2003/01/27 17:12:27 mike Exp $"
+ * "$Id: usb.c,v 1.18.2.25 2003/07/06 20:20:29 mike Exp $"
  *
  *   USB port backend for the Common UNIX Printing System (CUPS).
  *
@@ -323,6 +323,8 @@ decode_device_id(int        port,           /* I - Port number */
   char *attr,                                  /* 1284 attribute */
        *delim,                                 /* 1284 delimiter */
        *uriptr,                                /* Pointer into URI */
+       *mfg,                                   /* Manufacturer string */
+       *mdl,                                   /* Model string */
        serial_number[1024];                    /* Serial number string */
 
 
@@ -335,6 +337,16 @@ decode_device_id(int        port,          /* I - Port number */
   else if ((attr = strstr(device_id, "DESCRIPTION:")) != NULL)
     attr += 12;
 
+  if ((mfg = strstr(device_id, "MANUFACTURER:")) != NULL)
+    mfg += 13;
+  else if ((mfg = strstr(device_id, "MFG:")) != NULL)
+    mfg += 4;
+
+  if ((mdl = strstr(device_id, "MODEL:")) != NULL)
+    mdl += 6;
+  else if ((mdl = strstr(device_id, "MDL:")) != NULL)
+    mdl += 4;
+
   if (attr)
   {
     if (strncasecmp(attr, "Hewlett-Packard ", 16) == 0)
@@ -350,8 +362,31 @@ decode_device_id(int        port,          /* I - Port number */
     if ((delim = strchr(make_model, ';')) != NULL)
       *delim = '\0';
   }
+  else if (mfg && mdl)
+  {
+   /*
+    * Build a make-model string from the manufacturer and model attributes...
+    */
+
+    strlcpy(make_model, mfg, mmsize);
+
+    if ((delim = strchr(make_model, ';')) != NULL)
+      *delim = '\0';
+
+    strlcat(make_model, " ", mmsize);
+    strlcat(make_model, mdl, mmsize);
+
+    if ((delim = strchr(make_model, ';')) != NULL)
+      *delim = '\0';
+  }
   else
+  {
+   /*
+    * Use "Unknown" as the printer make and model...
+    */
+
     strlcpy(make_model, "Unknown", mmsize);
+  }
 
  /*
   * Look for the serial number field...
@@ -648,7 +683,15 @@ open_device(const char *uri)               /* I - Device URI */
                         device_uri, sizeof(device_uri));
 
         if (strcmp(uri, device_uri) == 0)
-         return (fd);  /* Yes, return this file descriptor... */
+       {
+        /*
+         * Yes, return this file descriptor...
+         */
+
+         fprintf(stderr, "DEBUG: Printer using device file \"%s\"...\n", device);
+
+         return (fd);
+       }
       }
 
      /*
@@ -748,5 +791,5 @@ open_device(const char *uri)                /* I - Device URI */
 
 
 /*
- * End of "$Id: usb.c,v 1.18.2.24 2003/01/27 17:12:27 mike Exp $".
+ * End of "$Id: usb.c,v 1.18.2.25 2003/07/06 20:20:29 mike Exp $".
  */