[Foomatic] Using usb IDs for autodetection

Johannes Meixner jsmeix at suse.de
Thu Apr 8 01:50:30 PDT 2004


Hello,

On Apr 7 13:56 Joe Shaw wrote (shortened):
> I noticed that the foomatic printer XML files have an <autodetect> flag,
> but virtually none of the printers have anything in it.  Most existing
> tools which deal with foomatic try to guess the printer by doing hacky
> string comparisons of the <make> and <model> tags with whatever the USB
> or IEEE-1284 interfaces gave back.  It works some of the time, but is
> pretty unreliable generally.

I am sorry but I think at the moment this is a waste of time.
At least I wasted much time with this in the past.

Of course I understand your intention very well but you may
find out that it is very very much work for only a little bit
better printer setup.

Of course it would be nice to have the exact IEEE-1284 and/or USB
IDs in the <autodetect>...</autodetect> section but at the moment
the effort seems to bee too much compared to the result.

1.
Unfortunately we (at least I) don't have many of those IDs.
I asked my colleagues, our beta testers and several printer manufacturers
again and again to send me those strings and all I got are the IDs
for some models so that for very most models I don't know the IDs.
Therefore in most cases we must do string comparison of the 
*Manufacturer and *ModelName in the PPD with whatever the USB
or IEEE-1284 interface gives back.

2.
Even if we had all ths IDs for all printers which are in the
Foomatic database we don't have them for PostScript printers
for which we have PPDs from the manufacturers.
Of course there should be *1284DeviceID in the PPD but in very most
of the PPDs it isn't (except Kyocera's PPDs).
Therefore at least for PostScript printers we must do string
comparison of the *Manufacturer and *ModelName in the PPD
with whatever the USB or IEEE-1284 interface gives back.

3.
Even if we had all USB and parallel port IDs we still need the SNMP IDs.
I think a real solution must work for USB, parallel port and network.

4.
String comparison of the *Manufacturer and *ModelName in the PPD
with whatever the USB or IEEE-1284 interface gives back works well
in very most cases.
Not a strict string matching but with some trivial "magic" like
- upshift all characters
- remove all whitespace characters
- remove meaningless characters like '-' and '/'
  (but don't remove the meaningful character '+')



Nevertheless string comparison cannot be the final solution because:

The *Manufacturer and *ModelName in the PPDs from manufacturers
are often too different from tose of Foomatic so that
manufacturer's PPDs and Foomatic's PPDs for the same model appear
as differnernt model names in the model lists of the printer
configuration tool (e.g. CUPS web interface).

In particular *ModelName like "HP LaserJet 4000 Series",
"HP LaserJet 4050 Series" and "HP LaserJet 4100 Series "
(note the trailing space in HPs original PPD)
may match with some additional magic (remove trailing "Series")
to the "HP LaserJet 4000", "HP LaserJet 4050" and "HP LaserJet 4100"
but of course not to any other printer of the particular series.
Of course with "special HP series magic" would help (see below)
but I do not want to use such weird manufacturer dependent magic.

Another example:
HP's original PPD for the "HP LaserJet 1200" fits also for the
LaserJet 1220 because this is a LaserJet 1200 printer with the
optional scanner unit alrerady mounted on the printer.
Note that the USB and/or IEEE-1284 IDs change from "LaserJet 1200"
to "LaserJet 1220" when the scanner is mounted.

Therefore string comparison does not not find all available PPDs
for a particular model.
Therefore string comparison cannot be the final solution.


The final soulution is to use the *1284DeviceID in the PPD
if it exists and as fallback the string comparison.

According to the Adobe PPD spec. it seems to be not forbidden
to have multiple *1284DeviceID entries in the PPD.

Therefore we can have multiple *1284DeviceID entries in the PPD
- if USB and/or parallel port and/or SNMP IDs are different
- if the PPD matches to multiple printers
  (e.g. "LaserJet 1200 Series", "LaserJet 4000 Series",
   "LaserJet 4050 Series", "LaserJet 4100 Series")

The PPD matches to a prticular printer model
if one of the multiple *1284DeviceID entries match to
   whatever the USB or IEEE-1284 interface or SNMP query gives back
or if *Manufacturer and *ModelName string comparison match to
      whatever the USB or IEEE-1284 interface or SNMP query gives back


> I'm not aware of an existing database which contains the IEEE-1284 data
> for a large number of the printers, so it's not really feasible to fill
> in the <autodetect> sections for most printers without having the
> hardware itself.

That is exactly the problem.

> We do, however, have a database of the USB vendor and
> product IDs for virtually every USB printer in the usb.ids file that
> every Linux distro ships.

It seems the usb.ids on my workstation is totally outdated because
there are at most 1% of all available USB printers listed :-(


Kind regards,
Johannes Meixner
-- 
SUSE LINUX AG, Maxfeldstrasse 5                 Mail: jsmeix at suse.de
90409 Nuernberg, Germany                    WWW: http://www.suse.de/


PS:

The weird "special HP series magic":

As far as I know for HP the following special rules
what "series" means should be correct:

- "DeskJet 690C series" means all printers which match to
  the regular expression "DeskJet 69[0-9][a-zA-Z]*"

- "DeskJet 600 series" means not all printers which match to
  the regular expression "DeskJet 6[0-9][0-9][a-zA-Z]*"
  because this regular expression would match to "DeskJet 695C"
  as well but this is in fact the "DeskJet 690C series"   

- "LaserJet 1200 series" means all printers which match to
  the regular expression "LaserJet 12[0-9][0-9][a-zA-Z]*"

- "LaserJet 1000 series" means not all printers which match to
  the regular expression "LaserJet 1[0-9][0-9][0-9][a-zA-Z]*"
  because this regular expression would match to "LaserJet 1220"
  as well but this is in fact the "LaserJet 1200 series"

Therefore when searching the matching series the search must be
done with ascending number of [0-9] entries - for example:
1. If $modelname matches "DeskJet 69[0-9][a-zA-Z]*"
   then it is a "DeskJet 690C series"
2. If $modelname matches "DeskJet 6[0-9][0-9][a-zA-Z]*"
   then it is a "DeskJet 600 series"
3. If $modelname matches "LaserJet 12[0-9][0-9][a-zA-Z]*"
   then it is a "LaserJet 1200 series"
4. If $modelname matches "LaserJet 1[0-9][0-9][0-9][a-zA-Z]*"
   then it is a "LaserJet 1000 series"





More information about the Printing-foomatic mailing list