/*
- * "$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).
*
char *attr, /* 1284 attribute */
*delim, /* 1284 delimiter */
*uriptr, /* Pointer into URI */
+ *mfg, /* Manufacturer string */
+ *mdl, /* Model string */
serial_number[1024]; /* Serial number string */
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)
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...
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);
+ }
}
/*
/*
- * 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 $".
*/