REGRESSION: IEEE-1284 device IDs in PPDs must exactly match what the printers report

Bug #349547 reported by Till Kamppeter on 2009-03-27
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
HPLIP
Undecided
Unassigned
hplip (Ubuntu)
Undecided
Unassigned

Bug Description

From HPLIP 3.9.2 on the IEEE-1284 device IDs in the PPD files are totally broken. The PPD for the HP PhotoSmart C8100 contains for example:

*1284DeviceID: "MFG:HP;MDL:photosmart_c8100_series;DES:photosmart_c8100_series;"

whereas the printer (on USB) reports (fields for status reporting left out):

MFG:HP;MDL:Photosmart C8100 series;CMD:MLC,PCL,PML,DW-PCL,DESKJET,DYN;1284.4DL:4d,4e,1;CLS:PRINTER;DES:L2526;

The fields of the device ID in the PPD file must exactly match the corresponding fields in the device ID reported by the printer, as the device ID is used for reliable auto-assignment of the correct driver/PPD file to the printer. So the PPD must contain the following:

*1284DeviceID: "MFG:HP;MDL:Photosmart C8100 series;DES:L2526;"

Can you please fix all the PPDs? In HPLIP 2.x.x this was still correct.

I appreciate if you can provide me a patch before April 2 (deep freeze for Ubuntu Jaunty release).

Till Kamppeter (till-kamppeter) wrote :

Sorry, Jaunty final freeze is April 9, but it would be nice if you could give me the patch before April 6, as on April 7 I am leaving for the OpenPrinting Summit.

Changed in hplip:
assignee: nobody → kalosaurusrex
status: New → Triaged
David Suffield (david-suffield) wrote :

Working on a fix to remove the "_" characters, but any model matching must be case insensitive.

Johannes Meixner (jsmeix) wrote :

Why must matching regarding the 1284DeviceID be case insensitive?

As far as I know the values in the sub-strings in 1284DeviceID
are exactly the sequence of characters which is spit out
by the printer hardware when device discovery (e.g. via USB) happens.

David,
could you provide (preferably via an official public developer documentation)
how exactly model matching must be implemented (preferably with example
code e.g. in C or via command line tools like grep and sed)?

David Suffield (david-suffield) wrote :

There is a hpmud C API (hpmud_get_model()) that takes a device-id string as input, parses out the MODEL: field, then generalizes the returned model string (see hpmud.h).

Then with the generalized model string you can use a simple strcasecmp() on PPD file name (or *NickName with the above fix) for auto-discovery.

If you want to extract the code into your own utility that is not hplip or hpmud specific here is the code from hpmud.c.

int generalize_serial(const char *sz, char *buf, int bufSize)
{
   const char *pMd=sz;
   int i, j;

   for (i=0; pMd[i] == ' ' && i < bufSize; i++); /* eat leading white space */

   for (j=0; (pMd[i] != 0) && (i < bufSize); i++)
   {
      buf[j++] = pMd[i];
   }

   for (i--; buf[i] == '_' && i > 0; i--); /* eat trailing white space */

   buf[++i] = 0;

   return i; /* length does not include zero termination */
}

/* Parse the model from the IEEE 1284 device id string and generalize the model name */
int hpmud_get_model(const char *id, char *buf, int buf_size)
{
   char *pMd;

   buf[0] = 0;

   if ((pMd = strstr(id, "MDL:")) != NULL)
      pMd+=4;
   else if ((pMd = strstr(id, "MODEL:")) != NULL)
      pMd+=6;
   else
      return 0;

   return generalize_model(pMd, buf, buf_size);
}

-dave

David Suffield (david-suffield) wrote :

Here is a 3.9.2 patch for the hpijs.drv.in file. This patch will have separate ShortNickName and Nickname strings. Only the ShortNickName is abbreviated to maintain 31 character limit.

This patch also converts "_" to " " in the device-id attribute.

-dave

Martin Pitt (pitti) wrote :

Till uploaded a fix to the queue.

Changed in hplip (Ubuntu):
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.9.2-3ubuntu4

---------------
hplip (3.9.2-3ubuntu4) jaunty; urgency=low

  * debian/patches/nicknames-device-ids.dpatch: Added patch from upstream
    for not shortening the *NickName: entries in the PPDs and not to replace
    " " by "_" in the device IDs in the PPDs (Upstream bugs: LP: #349539,
    LP: #349547).

 -- Till Kamppeter <email address hidden> Mon, 30 Mar 2009 00:56:49 -0700

Changed in hplip (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers