summaryrefslogtreecommitdiff
path: root/debian/patches/airprint-support.patch
blob: b3eaaf773042ba4794ff7d6ec42d903a3184af96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Tue, 9 Aug 2016 18:11:29 +0200
Subject: Patch to support Apple AirPrint (printing from iPhone, iPad,
 iPod Touch to a CUPS server)

Bug-Ubuntu: https://bugs.launchpad.net/bugs/711779
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1054495
Bug-Debian: http://bugs.debian.org/700961
Bug: https://cups.org/str.php?L4341
Last-Update: 2015-02-10

Patch-Name: airprint-support.patch
---
 conf/mime.convs.in   | 3 +++
 conf/mime.types      | 3 +++
 scheduler/conf.c     | 2 +-
 scheduler/dirsvc.c   | 6 ++++++
 scheduler/printers.c | 4 +++-
 5 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/conf/mime.convs.in b/conf/mime.convs.in
index 57b459d..e042e01 100644
--- a/conf/mime.convs.in
+++ b/conf/mime.convs.in
@@ -44,6 +44,9 @@ application/postscript		application/vnd.cups-postscript	66	pstops
 application/vnd.cups-raster	image/pwg-raster		100	rastertopwg
 application/vnd.cups-raster	image/urf			100	rastertopwg
 
+# Needed for printing from iOS (AirPrint) clients
+image/urf    	      	       application/pdf			100	-
+
 ########################################################################
 #
 # Raw filter...
diff --git a/conf/mime.types b/conf/mime.types
index fcd6b6e..ebb0525 100644
--- a/conf/mime.types
+++ b/conf/mime.types
@@ -108,6 +108,9 @@ image/x-alias			pix short(8,8) short(8,24)
 image/x-bitmap			bmp string(0,BM) + !printable(2,14)
 image/x-icon			ico
 
+# Needed for printing from iOS (AirPrint) clients
+image/urf			urf string(0,UNIRAST<00>)
+
 ########################################################################
 #
 # Text files...
diff --git a/scheduler/conf.c b/scheduler/conf.c
index bb6049b..bb4f9d2 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -745,7 +745,7 @@ cupsdReadConfiguration(void)
   DefaultShared            = CUPS_DEFAULT_DEFAULT_SHARED;
 
 #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
-  cupsdSetString(&DNSSDSubTypes, "_cups,_print");
+  cupsdSetString(&DNSSDSubTypes, "_cups,_print,_universal");
   cupsdClearString(&DNSSDHostName);
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c
index ddd3701..fb2a305 100644
--- a/scheduler/dirsvc.c
+++ b/scheduler/dirsvc.c
@@ -440,6 +440,12 @@ dnssdBuildTxtRecord(
     keyvalue[count  ][0] = "pdl";
     keyvalue[count++][1] = p->pdl ? p->pdl : "application/postscript";
 
+    /* iOS 6 does not accept this printer as AirPrint printer if there is
+       no URF txt record or "URF=none", "DM3" is the minimum needed found
+       by try and error */
+    keyvalue[count  ][0] = "URF";
+    keyvalue[count++][1] = "DM3";
+
     if (get_auth_info_required(p, air_str, sizeof(air_str)))
     {
       keyvalue[count  ][0] = "air";
diff --git a/scheduler/printers.c b/scheduler/printers.c
index 1984a65..2578aa7 100644
--- a/scheduler/printers.c
+++ b/scheduler/printers.c
@@ -3811,7 +3811,9 @@ add_printer_formats(cupsd_printer_t *p)	/* I - Printer */
       }
       else if (!_cups_strcasecmp(type->super, "image"))
       {
-        if (!_cups_strcasecmp(type->type, "jpeg"))
+        if (!_cups_strcasecmp(type->type, "urf"))
+	  strlcat(pdl, "image/urf,", sizeof(pdl));
+	else if (!_cups_strcasecmp(type->type, "jpeg"))
 	  strlcat(pdl, "image/jpeg,", sizeof(pdl));
 	else if (!_cups_strcasecmp(type->type, "png"))
 	  strlcat(pdl, "image/png,", sizeof(pdl));