Features/AutomaticPrintDriverInstallation

= Automatic printer driver installation =

Summary
Packages like gutenprint-cups, hpijs, and foomatic should be installed on-demand when hardware requiring those drivers is detected.

Owner

 * Name: Tim Waugh


 * email: twaugh@redhat.com

Current status

 * Targeted release: Fedora 13
 * Last Updated: 2010-02-17
 * Percentage of completion: 100%

Detailed Description
All printers, whether connected by parallel port, USB, bluetooth or network, identify themselves using an IEEE 1284 Device ID string. This is a sequence of key:value pairs with, among others, fields for the manufacturer, the model, the command sets supported by the printer.

The idea behind this feature is to add RPM tags to printer driver packages to match up with the manufacturer and model fields used by printers to identify themselves. Once this is done system-config-printer can use PackageKit to install the driver required for a printer when it is connected, or when a queue is set up for it interactively.

The way these RPM tags can be added automatically to printer driver packages is by using a "provides" script. This will look for PPD files, read through them to find a "1284DeviceID" PPD attribute, and parse the IEEE 1284 Device ID string to extract the "MFG" and "MDL" fields. Here is an example of a snippet of a PPD that contains a 1284DeviceID attribute:


 * %==== General Information Keywords ========================
 * FormatVersion: "4.3"
 * FileVersion: "1.03"
 * LanguageEncoding: ISOLatin1
 * LanguageVersion: English
 * Manufacturer: "Brother"
 * PCFileName: "BR5250_2.PPD"
 * Product: "(Brother HL-5250DN series)"
 * PSVersion: "(3010.106) 5"
 * ShortNickName: "Brother HL-5250DN BR-Script3"
 * ModelName: "Brother HL-5250DN BR-Script3"
 * NickName: "Brother HL-5250DN BR-Script3"
 * 1284DeviceID: "MFG:Brother;MDL:HL-5250DN series;CMD:PJL,PCL,PCLXL,POSTSCRIPT;"

PPD files are the simplest way for a driver to make itself available through CUPS. Another way is to provide a driver information file, and similarly to PPD files these must include a 1284DeviceID attribute for each PPD they define in order for automatic printer driver installation to work. The hpcups driver from the hplip package is an example of this type.

Yet another way for a driver to integrate with CUPS is for it to provide a CUPS driver. This is a program that generates PPD files on demand. When CUPS runs the program with "list" as its argument, it must write out a list of all the PPDs it is prepared to generate. In order for the manufacturers and models to be automatically tagged in the RPM package, this list must contain the appropriate Device ID strings. The gutenprint-cups and foomatic packages have examples of this type of driver.

To ensure a printer driver's binary RPMs are given postscriptdriver tags, add "BuildRequires: python-cups, cups" to the RPM spec file.

Dynamic drivers should ensure they can be executed from within the build root of their source package. The DESTDIR environment variable will be set when run this way. The gutenprint package has been patched to use DESTDIR to search for its XML files when the dynamic driver is run, for example.

Benefit to Fedora
Very often the wrong driver is used and bugs are reported about "the" driver not working, when the answer was to install another package. Of course it is also easy to be misled into thinking that there is no driver for a particular model simply because that model does not show in the CUPS model list (that list is built from the information provided by the installed drivers).

Scope

 * All the printer drivers need to report IEEE 1284 Device IDs, including at least the MFG and MDL fields, for the majority of the printers they support.
 * HPLIP and gutenprint (DONE)
 * Still needed for others such as pbm2l2030 and other small drivers like that -- but do any of them provide PPDs?
 * PackageKit needs support for the new tag type (DONE)
 * RPM needs to be able to add the tags (DONE)
 * system-config-printer needs to be able to install packages for automatically-detected USB printers (DONE)
 * system-config-printer needs to be able to install packages for printers when manually adding a queue (DONE)
 * gnome-packagekit needs new D-Bus API method (DONE)
 * kpackagekit needs same (DONE)
 * kdeutils-printer-applet needs system service added (DONE)

Connecting a USB printer
Start with the relevant driver package for your printer *not* installed and the printer disconnected.

Connect the printer and power it on.

You may be asked for authentication to install packages.

You should be asked to print a test page.

You must be able to print to the printer.

Adding a queue manually
Start with the relevant driver package for your printer *not* installed.

Select System->Administration->Printing.

Select a network printer (can be 'Internet Printing Protocol' for another CUPS server).

You may be asked for authentication to install packages.

If a list of drivers is shown, the correct driver should already be selected in the list.

You should be asked to print a test page.

You must be able to print to the printer.

User Experience
Plugging in a printer just works, whenever this is possible. The LiveCD does not have to ship with printer drivers on it.

Dependencies

 * DONE: rpm (bug #538101)
 * DONE: gnome-packagekit (bug #558450)

Contingency Plan
Revert to previous behaviour.

Add foomatic-db-ppds to comps.

Documentation
In addition to this page, some other resources (below) may be helpful.

I gave a presentation about this at the OpenPrinting Summit in April 2010. Read the slides (PDF) while listening to the audio recording (MP3) (note the audio is for the entire morning, 3h 7min; my presentation is only the first hour).

There is also an email I sent to the cups.general mailing list. That link may or may not be stable; if it points to the wrong message look for Mon 24 May 2010, "Searching for a PPD in Driver list".

Release Notes
Printer drivers are now installed automatically when a printer is connected.

Comments and Discussion

 * See Talk:Features/AutomaticPrintDriverInstallation