Client solution for CUPS' new Avahi-based printer share broadcasting

Registered by Till Kamppeter

The CUPS Browsing/Broadcasting mechanism which made print queues shared on remote CUPS servers automatically visible for the local CUPS daemon and so for local applications got dropped upstream from CUPS 1.6.x on. Ubpstream has replaced this functionality by Bonjour-based broadcasting (under Linux implemented via Avahi), an OS-indpendent PWG (Printing Working Group) standard, but this lacks the implementation of browsing on the client side making the printers on remote CUPS servers not automatically appearing any more.

Quantal's CUPS has a mega patch to forward-port this functionality from the old CUPS for one cycle, to avoid regressions. We cannot carry such a patch eternally, and we should follow upstream and the PWG standards.

So in Raring we need the real solution which means that the print dialogs (upstream-recommended solution) or the CUPS daemon (how I like to have it) takes the new Bonjour (Avahi) broadcasts to display the shared remote CUPS queues automatically. The browsing functionality is implemented in the CUPS library (libcups) from CUPS 1.6.x on, but there is currently no production code using these functions.

Upstream expects the print dialogs to use the new library functions for displaying the new queues. This would require modifications and upstream submissions for GTK, Qt, and LibreOffice at least and this does not safely cover all existing applications which have CUPS-aware print dialogs and therefore listed the remote queues before. Especially printing from the command line would not be covered.

The better approach would be modifying the CUPS daemon so that it uses the new library function to find the remote queues and advertize them like its own local queues. Where the CUPS daemon needs to be patched for that we could probably derive from Quantal's CUPS Broadcasting/Browsing forward port patch. The new Bonjour browsing patch being based on the new standard way of Bonjour broadcasting has probably good chances to be accepted upstream.

This feature does not only prevent a regression, but it also helps to more easily access printers connected to Mac OS X machines (they broadcasted Bonjour-only all the time) and also for mobile Ubuntu devices. Usually you do not have connected printers to tablets or phones and you carry them around between different local networks, so here it is especially important that they automatically pick up the print queues in the local network.

In the session we will discuss which method to use and the implementation in Raring.

Blueprint information

Sebastien Bacher
Till Kamppeter
Needs approval
Till Kamppeter
Series goal:
Accepted for raring
Milestone target:
milestone icon ubuntu-13.04
Started by
Till Kamppeter
Completed by
Till Kamppeter


tkamppeter, 2013-04-01:
With the help of patches from Tim Waugh from Red Hat cups-browsed also supports the old CUPS broadcasting and browsing for communication with legacy CUPS versions (1.5.x and earlier) which can be activated via the /etc/cups/cups-browsed.conf file. With this the browsing functionality is completely recovered and the alternative solution of Bonjour browsing in the print dialogs is not absolutely necessary. Therefore I am closing this Blueprint as done now.

tkamppeter, 2013-03-09:
Tim Waugh from Red Hat has contributed support for the old CUPS Broadcasting and Browsing to cups-browsed. This can get optionally activated by config file to communicate with old CUPS systems.

tkamppeter, 2013-03-04:
GTK print dialog has Bonjour browsing functionality added upstream now (Bug #1082519, GNOME upstream bug #688956).

tkamppeter, 2013-01-07:
Removed forward-port patch of the CUPS broadcasting/browsing from CUPS 1.5.x of Raring's CUPS 1.6.1, as with cups-browsed we have the real solution now.

tkamppeter, 2012-12-29:
Released cups-filters 1.0.28 upstream, containing cups-browsed, a daemon which browses the Bonjour broadcasts of remote CUPS printers and automatically adds, updates, and removes local queues pointing to the remote printers according to the broadcasts. The user experience equals the old behavior of CUPS broadcasting/browsing times: Remote CUPS queues are automatically available locally, for all applications and the command line.

tkamppeter, 2012-11-27:
Upstream feature request for the LibreOffice print dialog:

tkamppeter, 2012-11-26:
Marek Kasik has accepted the rquest to add Bonjour browsing to the GTK print dialog and is working on it.

tkamppeter, 2012-11-23:
Upstream feature requests:

tkamppeter, 2012-11-22:
Discussion on the CUPS General mailing list:

tkamppeter, 2012-11-22:
I have settled now on the following decision:

1. Print dialogs of both GTK and Qt should browse Bonjour-broadcasted remote printers and add them to the list of available printers, using the new cupsEnumDests() function of the CUPS library. I have informed the upstream maintainers of the print dialogs, Marek Kasik (GTK) and John Layt (Qt). This also eliminates the need of a local CUPS daemon on a machine with no local print queues, making printing with configuration-less clients more mobile-friendly.

2. Extra daemon (cups-browsed) for legacy broadcasting/browsing support, no patch of the CUPS daemon. Daemon should at least do (discussing with Johannes Meixner from SUSE):

a. Browse Bonjour broadcasts of remote printers and create/remove local raw queues pointing to these printers appropriately. This recovers the automatic appearing of remote queues in all-CUPS-1.6.x environments (my initial idea).

If I get cooperation with SUSE the damon should also:

b. Browse CUPS broadcasts of remote printers and create/remove local raw queues pointing to these printers appropriately. This recovers the automatic appearing of remote queues for CUPS 1.6.x clients with CUPS 1.5.x (and older) servers.

c. Broadcast local queues in the old CUPS protocol. This recovers the automatic appearing of remote queues for CUPS 1.5.x (or older) clients with CUPS 1.6.x servers (Johannes' initial idea).

The daemon serves only to prevent regressions when legacy CUPS versions or applications are used. With proper implementation (1) everywhere we will not need this daemon any more.

tkamppeter, 2012-11-16:
The discussion of the SUSE bug report led me to the idea to perhaps create a separate daemon which listens to Bonjour broadcasts of printers and creates/removes CUPS queues pointing to the remote printers automatically. This extra daemon would eliminate the need of submitting any patch to CUPS upstream and carrying it as distro patch if upstream rejects it. The extra daemon I could host as part of the cups-filters package and packagers of distros could put the daemon into a separate binary to allow admins to opt out of the extra daemon.


tkamppeter, 2012-11-06: Work items added.


Work Items

Work items:
[till-kamppeter] Evaluate the possibilities to make the CUPS daemon discovering remote printers advertized by Bonjour and make them available as virtual queues locally, like the CUPS daemon did before with remote CUPS-broadcasted queues (Bonjour Browsing): DONE
[till-kamppeter] Implement Bonjour Browsing as an extra daemon (cups-browsed) to be upstream-hosted in the cups-filters packages: DONE
[till-kamppeter] Add also CUPS Broadcasting/Browsing to this daemon: DONE
[till-kamppeter] Work with desktop toolkit people (GTK, Qt, LibreOffice) about using the new CUPS library functions in the print dialogs: DONE
[till-kamppeter] Propose the solution upstream to GTK, Qt, LibreOffice, and CUPS: DONE