AirPrint support in the Avahi patch for CUPS does not work

Bug #711779 reported by pinzia
20
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cups (Ubuntu)
Fix Released
Medium
Unassigned
Natty
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: cups

Would be nice to show that Ubuntu is also better of the same Macinstosh in the management of the new 'protocols' Apple.
Add to CUPS functionality "Airprint" is really easy.
Here the demonstration
http://hartlessbydesign.com/blog/view/197-airprint-with-ubuntu-1010

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: cups 1.4.4-6ubuntu2.3
ProcVersionSignature: Ubuntu 2.6.35-25.44-generic 2.6.35.10
Uname: Linux 2.6.35-25-generic x86_64
Architecture: amd64
CupsErrorLog:

Date: Wed Feb 2 11:40:08 2011
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64 (20101007)
Lpstat: device for UTAX_TA-CD-1120_DC-2120-CD-1120_DC-2120: dnssd://FOTOCOPIATRICE._ipp._tcp.local/
Lsusb:
 Bus 004 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
 Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Papersize: a4
PpdFiles: UTAX_TA-CD-1120_DC-2120-CD-1120_DC-2120: Generic PCL 5 Printer - CUPS+Gutenprint v5.2.6 Simplified
ProcCmdLine: BOOT_IMAGE=/boot/vmlinuz-2.6.35-25-generic root=UUID=220be523-7a0b-4eb0-8cbd-896932b0d56e ro quiet splash nolapic
ProcEnviron:
 LANG=it_IT.utf8
 SHELL=/bin/bash
SourcePackage: cups
dmi.bios.date: 11/30/2005
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: P1.40
dmi.board.asset.tag: 00000000
dmi.board.name: 939S56-M
dmi.board.version: 1.00
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvrP1.40:bd11/30/2005:svn:pn939S56-M:pvr1.00:rvn:rn939S56-M:rvr1.00:
dmi.product.name: 939S56-M
dmi.product.version: 1.00

Revision history for this message
pinzia (pinzia) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, is there perhaps a possibility to make this fully automatic (without need of any Avahi service files) by modifying your Avahi support patch for CUPS?

Changed in cups (Ubuntu):
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Tim Waugh (twaugh) wrote :

Does the Avahi patch even need modification in order for this to work? Seems to me that's just Bonjour service announcement.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

pinzia, the upcoming Ubuntu Natty (11.04) has BonJour printer broadcasting support built into CUPS. Perhaps Apple's Airprint is not more than this. So please try it out.

Boot a live CD of Natty (Daily Live CD), create a print queue within the live session and share it (System ->Administration -> Printing, Server -> Settings, Publish shared printers connected to this system, also right-click printer, Properties, Policies, Shared). The try to print from your iPad, iPhone, and/or Mac. Does it work now?

Revision history for this message
pinzia (pinzia) wrote :

Thanks I'll try in virtualbox.

Revision history for this message
pinzia (pinzia) wrote :

sorry but it don't work for me.
I tried without file modification, and then with file /etc/avahi/services/printer.service...don't work
any suggestions?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Lars, have you any idea here? Can you try this out?

Revision history for this message
Stefan Bethke (stb) wrote :

I believe the missing bit (to allow iOS 4 devices to recognize the printer) is adding the announcement of the image/urf MIME type, plus the URF=W8,SRGB24,CP1,RS600 value. (I suspect that the URF key might not be necessary, but I haven't tried without.)

As far as I can tell, nobody really knows what URF images look like, but right now, all iOS print jobs are submitted as PDF, so it has little relevance.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Stefan, can you test this? For the server to announce this MIME type you need to add it to /etc/cups/mime.types (without auto-detection rule) and add a dummy conversion rule to /etc/cups/mime.convs (let it get converted to PDF using the filter named "-") and then restart CUPS. Does the iOS client find the printer now?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Stefan, please try the instructions on the page linked in my previous comment (comment #10, NOT comment #9). If it works, we will look into patching CUPS so that the Avahi service file is not needed any more and iOS devices will "just print" with Ubuntu Oneiric.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The AirPrint problem can also be caused by bug 792309, a byte order problem in the announcement of the port number by Avahi.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Bug 792309 is fixed now. Please try the new CUPS packages (1.4.6-7 on Debian unstable and Ubuntu Oneiric, 1.4.6-5ubuntu1.4 as SRU for Ubuntu Natty, see bug 792309) as soon as they get available and tell here whether the change fixes your problems and whether then even AirPrint works without any additional Avahi service definition file.

Changed in cups (Ubuntu):
importance: Wishlist → Medium
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Looking into the code of the Avahi patch for CUPS AirPrint support was intended to work in this patch. It probably does not work only due to the missing text field "URF=none". It is a small patch to add it, which I am doing currently.

summary: - request feature: airprint support
+ AirPrint support in the Avahi patch for CUPS does not work
Changed in cups (Ubuntu):
status: Confirmed → In Progress
Changed in cups (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The fix is now committed to the Debian BZR repository of CUPS, so the next CUPS packages in Debian unstable and Ubuntu Oneiric will contain it. Please test as soon as the package gets available.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The change is simple. After having applied the cups-avahi.dpatch to add the Avahi support only this little patch needs to get applied in addition:

--- scheduler/dirsvc.c~ 2011-06-03 17:34:56.000000000 +0200
+++ scheduler/dirsvc.c 2011-06-03 23:15:32.000000000 +0200
@@ -3043,6 +3043,9 @@
   keyvalue[i ][0] = "pdl";
   keyvalue[i++][1] = p->pdl ? p->pdl : "application/postscript";

+ keyvalue[i ][0] = "URF";
+ keyvalue[i++][1] = "none";
+
   if (get_auth_info_required(p, air_str, sizeof(air_str)))
   {
     keyvalue[i ][0] = "air";

Then we should have CUPS advertizing the service correctly, at least according to http://www.finnie.org/2010/11/13/airprint-and-linux/.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, can you apply the change shown above to your Avahi patch?

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

An additional patch is needed which I have prepared already. I will post it here and add it to the BZR repository for CUPS later today.

Changed in cups (Ubuntu):
status: Fix Committed → In Progress
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

The additional patch is added to the BZR repository at Debian now, so the next CUPS packages in Debian unstable and Ubuntu Oneiric will contain it. Please test as soon as the package gets available.

Changed in cups (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, also the patch attached here needs to get added to the Avahi patch for CUPS. It adds the "_universal" subtype to the printer shares. This is also needed by AirPrint.

Changed in cups (Ubuntu Natty):
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

A fixed CUPS package for Natty is now uploaded the -proposed queue. As soon as it gets approved please test the new package. A comment with instructions will be posted here then. A debdiff of the changes is attached.

The new CUPS package does not fix only this bug, but in total five bugs (therefore the somewhat bigger debdiff): bug 711779, bug 782309, bug 790378, bug 792309, bug 793265. Any help on verifying these fixes is also welcome.

Revision history for this message
Martin Pitt (pitti) wrote : Please test proposed package

Accepted cups into natty-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.4.6-7

---------------
cups (1.4.6-7) unstable; urgency=low

  * debian/patches/cups-avahi.dpatch: Updated Avahi patch so that it does
    not generate too long service names which Avahi does not accept. Printers
    did not get advertized via DNS-SD then. (LP: #793265).
  * debian/patches/cups-avahi.dpatch: Updated Avahi patch to add the text
    field entry "URF=none" and the service subtype "_universal" so that
    mDNS/Bonjour-advertized printers are recognized by AirPrint clients
    (iPhone/iPad with iOS 4.2 or newer). (LP: #711779).
  * debian/patches/cups-avahi.dpatch: In contrary to the libdns_sd API the
    Avahi API requires port numbers in host order and not in network order.
    This made the Avahi-based DNS-SD broadcasting of CUPS advertizing wronmg
    port numbers. Updated the Avahi patch to fix it. Thanks to Tim Waugh
    from Red Hat on confirming this (LP: #792309).
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    memory leak in pdftopdf filter which made the filter taking up several
    gigabytes when processing certain PDF files. Thanks to upstream
    author Koji Otani for the quick fix (LP: #790378).
  * debian/local/pstopdf.convs, debian/local/pstopdf.types: Do not apply
    the PDF printing workflow to PostScript input coming from the Adobe
    Reader. If this PostScript comes from an encrypted (DRM) PDF, it cannot
    be converted to PDF again by Ghostscript (LP: #782309).
 -- Martin Pitt <email address hidden> Tue, 07 Jun 2011 07:04:11 +0200

Changed in cups (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Fix of this bug in Natty confirmed by Hadmut Danisch in bug 792309, comment #13. Thanks, Hadmut.

tags: added: verification-done
removed: verification-needed
Revision history for this message
Tim Waugh (twaugh) wrote :

I'm a bit uneasy about the URF=none and _universal._sub.* changes. What do they mean? In particular, why doesn't the existing upstream HAVE_DNSSD support in CUPS do this?

Changed in cups (Ubuntu):
assignee: nobody → Heru Herdianto (herdiantoheru-yahoo)
Changed in cups (Ubuntu Natty):
assignee: nobody → Heru Herdianto (herdiantoheru-yahoo)
status: Fix Committed → Confirmed
status: Confirmed → Fix Released
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

Tim, with the additions of URF=none and _universal._sub.* I followed these instructions:

http://www.finnie.org/2010/11/13/airprint-and-linux/

Looks like that the poster reverse-engineered the protocol and in addition, I do not have an appropriate device for testing. So I cannot say whether it works without these changes.

Changed in cups (Ubuntu Natty):
status: Fix Released → Fix Committed
Changed in cups (Ubuntu):
assignee: Heru Herdianto (herdiantoheru-yahoo) → nobody
Changed in cups (Ubuntu Natty):
assignee: Heru Herdianto (herdiantoheru-yahoo) → nobody
Revision history for this message
Tim Waugh (twaugh) wrote :

But look at the structure of the code. Wherever there's an API call to libdns_sd and supporting code for it, we have equivalent code for avahi. Code that applies to both was already there upstream.

These changes for airprint are in "neutral" territory, code that applies regardless of whether avahi or libdns_sd is used.

For that reason, they should be submitted upstream to cups (or at least suggested) so we can have some feedback on whether they're right, or whether there will be some unexpected consequence.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package cups - 1.4.6-5ubuntu1.2

---------------
cups (1.4.6-5ubuntu1.2) natty-proposed; urgency=low

  * debian/patches/cups-avahi.dpatch: Updated Avahi patch so that it does
    not generate too long service names which Avahi does not accept. Printers
    did not get advertized via DNS-SD then. (LP: #793265).
  * debian/patches/cups-avahi.dpatch: Updated Avahi patch to add the text
    field entry "URF=none" and the service subtype "_universal" so that
    mDNS/Bonjour-advertized printers are recognized by AirPrint clients
    (iPhone/iPad with iOS 4.2 or newer). (LP: #711779).
  * debian/patches/cups-avahi.dpatch: In contrary to the libdns_sd API the
    Avahi API requires port numbers in host order and not in network order.
    This made the Avahi-based DNS-SD broadcasting of CUPS advertizing wronmg
    port numbers. Updated the Avahi patch to fix it. Thanks to Tim Waugh
    from Red Hat on confirming this (LP: #792309).
  * debian/local/filters/pdf-filters/pdftopdf/P2PResources.cxx: Fixed
    memory leak in pdftopdf filter which made the filter taking up several
    gigabytes when processing certain PDF files. Thanks to upstream
    author Koji Otani for the quick fix (LP: #790378).
  * debian/local/pstopdf.convs, debian/local/pstopdf.types: Do not apply
    the PDF printing workflow to PostScript input coming from the Adobe
    Reader. If this PostScript comes from an encrypted (DRM) PDF, it cannot
    be converted to PDF again by Ghostscript (LP: #782309).
 -- Till Kamppeter <email address hidden> Mon, 5 Jun 2011 13:51:59 +0200

Changed in cups (Ubuntu Natty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.