[cups.general] Searching for PPD in Driver list
Tim Waugh
twaugh at redhat.com
Mon May 24 02:33:14 PDT 2010
On Sun, 2010-05-23 at 13:02 -0400, Alexander Cohen wrote:
> My question was not clear, sorry. I know how to use the cups API to
> get local PPD's. What im looking for is a WebService or some sort of
> online repository that I can programmatically query in order to find a
> PPD for a specific printer.
Take a look at this work that has gone into Fedora 13:
https://fedoraproject.org/wiki/Features/AutomaticPrintDriverInstallation
It is a method for doing exactly what you ask for. Given an IEEE 1284
Device ID, specifically the manufacturer (MFG) and model (MDL) fields,
it is now possible to perform a PackageKit query to find out which
packages, installed or not, provide drivers for that printer. Just use
the PK_PROVIDES_ENUM_POSTSCRIPT_DRIVER provides type in a WhatProvides
query, with this format: "mfg_string;mdl_string;". Your MFG and MDL
fields must be converted to lower case, and spaces converted to
underscores.
There is also a convenience API provided in the
org.freedesktop.PackageKit session service (e.g. gnome-packagekit).
Here is an example of calling this interface:
http://git.fedorahosted.org/git/?p=system-config-printer.git;a=blob;f=ppdsloader.py;hb=HEAD
It boils down to this:
import dbus
bus = dbus.SessionBus ()
obj = bus.get_object ("org.freedesktop.PackageKit",
"/org/freedesktop/PackageKit")
proxy = dbus.Interface (obj, "org.freedesktop.PackageKit.Modify")
proxy.InstallPrinterDrivers (xid, [device_id],
"hide-finished")
where xid is the window ID of your main window, or 0, and device_id is
your device's IEEE 1284 Device ID, unaltered. (Only the MFG and MDL
fields are required.)
This allows PackageKit to query *all* configured package repositories.
As this work is new, currently only the Fedora 13 package repository
will contain any matches. I hope other driver repositories will pick
this up once Fedora 13 is released.
In the future, perhaps there could be a CUPS yum repository for PPDs...
Tim.
*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <https://lists.cups.org/pipermail/cups/attachments/20100524/77e8f4f7/attachment.bin>
More information about the cups
mailing list