PolicyKit and printing

Tuesday, August 11th, 2009

gtk-dialog-authentication-100The latest release of Fedora allows more flexibility with configuring print queues and managing print jobs. This is because it is now able to use PolicyKit to do these things, which means you get to choose when and whether users should be prompted for authentication when performing administration tasks on printers or jobs. The implementation is slightly tricky, so I’ll explain the details.

(more…)

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.

Re-writing hal-cups-utils to avoid hal

Monday, July 20th, 2009

The program that adds printer queues when a USB printer is connected is hal-cups-utils. It is a simple program that hooks into hal, the hardware abstraction layer, and adds/enables/disables CUPS queues as necessary.

As hal will be going away shortly — that, and the fact that hal-cups-utils doesn’t really work very well — I have had a go at re-writing it as a udev rule over the last few days.

(more…)

Profiling Python

Thursday, July 16th, 2009

Yesterday I spent a little bit of time improving the speed of adding a new printer using system-config-printer. The main problem was that several bugs had conspired to make it search for all printer drivers three times instead of just once (oops). After fixing that I tried profiling it to see what was taking the most time.

(more…)

Generating ChangeLog files from commit logs

Thursday, June 25th, 2009

I love git, but I also loved ChangeLog files and git is not so good at merging them. For a while I played around with gnulib‘s git-merge-changelog which made merges really easy. It worked fairly well, but now I’m bored of documenting my changes twice, both in the ChangeLog file and in the git commit log.

The coreutils project has been creating its ChangeLog file from the git commit logs for a little while now, and I decided to take a look at how that’s done. Now, at last, system-config-printer can do that too. Here is how it works.

(more…)