D-Bus and Python: asynchronous method implementation

Tuesday, August 16th, 2011

This is a quick demonstration of how to implement a D-Bus method in Python using asynchronous callbacks.

I recently added support in system-config-printer for determining the best driver to use for a particular printer.  This is an expensive operation, largely because of the time it takes to get a list of available drivers from CUPS, and the Python program providing the D-Bus service also provides other services.  I wanted the program to be able to deal with other callers while the CUPS operation was in progress.  Here’s how that was done.

(more…)

Presenting at OpenPrinting Summit today

Thursday, April 15th, 2010

Just a quick note that I’ll be presenting by phone today, Thursday 15th April, at the OpenPrinting Summit on the topic of automatic printer driver installation in Fedora 13.  The talk is at 1600 UTC / 1700 BST, and was not Wednesday as scheduled.  The schedule hasn’t been updated yet, but when it is you can find it and the dial-in information here.

D-Bus system services for print queues

Sunday, July 26th, 2009

Further to the recent work on replacing hal-cups-utils, I’ve now split out the parts that use CUPS into a D-Bus system service. This allows udev to simply call the D-Bus methods and let the activated service deal with the potentially time-consuming bits. It also makes it a bit easier to get the SELinux security labelling right.

The interface is simple:

bus com.redhat.PrinterConfig
object /com/redhat/PrinterConfig
interface com.redhat.PrinterConfig

UsbPrinterAdd (STRING devpath, STRING deviceid)
UsbPrinterRemove (STRING devpath)

Next step: a D-Bus service for finding an appropriate PPD file for a given IEEE 1284 Device ID. This would allow the PrinterConfig implementation to avoid running a Python helper script to actually add the queue. The same goes for bluetooth devices.