tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

airprint patches for cups



Hello,
Major linux distributions (debian and Ubuntu at last) have patched their
cups for basic airprint support. These patches have been rejected by cups
because cups (i.e. apple) because cups is not fully airprint-complient,
but linux users seems to be happy with it.

Attached is a patch that adds this basic airprint support to our cups.
Would it be OK to commit ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/print/cups-base/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- Makefile	22 Jun 2018 14:12:45 -0000	1.11
+++ Makefile	20 Jul 2018 10:15:01 -0000
@@ -1,7 +1,7 @@
 # $NetBSD: Makefile,v 1.11 2018/06/22 14:12:45 bouyer Exp $
 
 .include "../../print/cups/Makefile.common"
-PKGREVISION=1
+PKGREVISION=2
 
 DISTNAME=	cups-${CUPS_VERS}-source
 PKGNAME=	cups-base-${CUPS_VERS}
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/print/cups-base/distinfo,v
retrieving revision 1.7
diff -u -r1.7 distinfo
--- distinfo	22 Jun 2018 14:12:45 -0000	1.7
+++ distinfo	20 Jul 2018 10:15:01 -0000
@@ -7,6 +7,10 @@
 SHA1 (patch-ae) = f34ec899f4816bdcf96ff315e001e3ac5a960200
 SHA1 (patch-af) = 6ae6ae6006387db69bf7c15f7c8500708c9e8f56
 SHA1 (patch-ai) = 2c1ca67ea6f6c1dedb4c8ff97736f328a2b9a7c6
+SHA1 (patch-airprint-conf_mime.convs.in) = 413a5ef448ab42858db804cfbfc1b8ff5b6bbf77
+SHA1 (patch-airprint-scheduler_conf.c) = f54ba16cc32dc09cd5bd8e864e1510ed2a84d6ed
+SHA1 (patch-airprint-scheduler_dirsvc.c) = bef4ea8e898dffc67c4866baa701e12570eb6fca
+SHA1 (patch-airprint-scheduler_printers.c) = 7fc0157f990a6e4dfa04c0b2c5684422229af725
 SHA1 (patch-at) = ef6303936daf0826dc4725f5369bfb1add832b1f
 SHA1 (patch-conf-cups-files.conf.in) = 327cc8b62e606389542870aa6619ade10377b044
 SHA1 (patch-conf_Makefile) = bb8313e493c02959edfe1e53f50b9f16ce6f42e0
Index: patches/patch-airprint-conf_mime.convs.in
===================================================================
RCS file: patches/patch-airprint-conf_mime.convs.in
diff -N patches/patch-airprint-conf_mime.convs.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-airprint-conf_mime.convs.in	20 Jul 2018 10:15:01 -0000
@@ -0,0 +1,37 @@
+$NetBSD: $
+
+From bbc3507a260d29db3fc5601826f33c10f9dccd1e Mon Sep 17 00:00:00 2001
+From: Till Kamppeter <till.kamppeter%gmail.com@localhost>
+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 bffd04f84..33ce812e3 100644
+--- conf/mime.convs.in.orig
++++ conf/mime.convs.in
+@@ -47,6 +47,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...
Index: patches/patch-airprint-scheduler_conf.c
===================================================================
RCS file: patches/patch-airprint-scheduler_conf.c
diff -N patches/patch-airprint-scheduler_conf.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-airprint-scheduler_conf.c	20 Jul 2018 10:15:01 -0000
@@ -0,0 +1,36 @@
+$NetBSD: $
+
+From bbc3507a260d29db3fc5601826f33c10f9dccd1e Mon Sep 17 00:00:00 2001
+From: Till Kamppeter <till.kamppeter%gmail.com@localhost>
+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/scheduler/conf.c b/scheduler/conf.c
+index 9c1be7089..52f2a6d35 100644
+--- scheduler/conf.c.orig
++++ 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");
+ #endif /* HAVE_DNSSD || HAVE_AVAHI */
+ 
+   cupsdSetString(&LPDConfigFile, CUPS_DEFAULT_LPD_CONFIG_FILE);
Index: patches/patch-airprint-scheduler_dirsvc.c
===================================================================
RCS file: patches/patch-airprint-scheduler_dirsvc.c
diff -N patches/patch-airprint-scheduler_dirsvc.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-airprint-scheduler_dirsvc.c	20 Jul 2018 10:15:01 -0000
@@ -0,0 +1,40 @@
+$NetBSD: $
+
+From bbc3507a260d29db3fc5601826f33c10f9dccd1e Mon Sep 17 00:00:00 2001
+From: Till Kamppeter <till.kamppeter%gmail.com@localhost>
+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/scheduler/dirsvc.c b/scheduler/dirsvc.c
+index 3dab90ca9..f21942af3 100644
+--- scheduler/dirsvc.c.orig
++++ scheduler/dirsvc.c
+@@ -443,6 +443,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";
Index: patches/patch-airprint-scheduler_printers.c
===================================================================
RCS file: patches/patch-airprint-scheduler_printers.c
diff -N patches/patch-airprint-scheduler_printers.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-airprint-scheduler_printers.c	20 Jul 2018 10:15:01 -0000
@@ -0,0 +1,152 @@
+$NetBSD: $
+
+From debian:
+From 7147c814439aafb26ff0262a7d6b8ef56d20969f Mon Sep 17 00:00:00 2001
+From: Till Kamppeter <till.kamppeter%gmail.com@localhost>
+Date: Tue, 9 Aug 2016 18:11:04 +0200
+Subject: For PWG Raster, add required IPP attributes
+
+Add required by IPP Everywhere for PWG Raster when PWG Raster as input format
+is supported
+
+Bug-Upstream: https://www.cups.org/str.php?L4428
+Last-Update: 2015-02-10
+Patch-Name: pwg-raster-attributes.patch
+---
+ scheduler/printers.c | 77 +++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 76 insertions(+), 1 deletion(-)
+
+diff --git a/scheduler/printers.c b/scheduler/printers.c
+index bb99907ad..a0ebcbd3e 100644
+--- scheduler/printers.c.orig
++++ scheduler/printers.c
+@@ -2199,9 +2199,10 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
+   cupsd_location_t *auth;		/* Pointer to authentication element */
+   const char	*auth_supported;	/* Authentication supported */
+   ipp_t		*oldattrs;		/* Old printer attributes */
+-  ipp_attribute_t *attr;		/* Attribute data */
++  ipp_attribute_t *attr, *attr2;	/* Attribute data */
+   char		*name,			/* Current user/group name */
+ 		*filter;		/* Current filter */
++  mime_type_t   *type;
+ 
+ 
+   DEBUG_printf(("cupsdSetPrinterAttrs: entering name = %s, type = %x\n", p->name,
+@@ -2538,6 +2539,80 @@ cupsdSetPrinterAttrs(cupsd_printer_t *p)/* I - Printer to setup */
+   DEBUG_printf(("cupsdSetPrinterAttrs: leaving name = %s, type = %x\n", p->name,
+                 p->type));
+ 
++  /* 
++   * Add "pwg-raster-document-xxx-supported" attributes if PWG Raster input
++   * is supported
++   */
++  for (type = (mime_type_t *)cupsArrayFirst(p->filetypes);
++       type;
++       type = (mime_type_t *)cupsArrayNext(p->filetypes))
++  {
++    if (!_cups_strcasecmp(type->super, "image"))
++    {
++      if (!_cups_strcasecmp(type->type, "pwg-raster"))
++      {
++	if (p->ppd_attrs != NULL &&
++	    (attr = ippFindAttribute(p->ppd_attrs,
++				     "printer-resolution-supported",
++				     IPP_TAG_ZERO)) != NULL)
++	{
++	  attr2 = ippAddResolutions(p->attrs, IPP_TAG_PRINTER,
++				    "pwg-raster-document-resolution-supported",
++				    attr->num_values, IPP_RES_PER_INCH,
++				    NULL, NULL);
++	  for (i = 0; i < attr->num_values; i ++)
++	  {
++	    attr2->values[i].resolution.xres =
++	      attr->values[i].resolution.xres;
++	    attr2->values[i].resolution.yres =
++	      attr->values[i].resolution.yres;
++	    attr2->values[i].resolution.units = IPP_RES_PER_INCH;
++	  }
++	}
++	else
++	{
++	  static const int	pwg_raster_document_resolution_supported[] =
++	  {
++	    300,
++	    600,
++	    1200
++	  };
++	  ippAddResolutions(p->attrs, IPP_TAG_PRINTER,
++			    "pwg-raster-document-resolution-supported",
++			    (int)(sizeof(pwg_raster_document_resolution_supported) /
++				  sizeof(pwg_raster_document_resolution_supported[0])),
++			    IPP_RES_PER_INCH,
++			    pwg_raster_document_resolution_supported,
++			    pwg_raster_document_resolution_supported);
++	}
++	ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
++		     "pwg-raster-document-sheet-back", NULL, "normal");
++	static const char * const pwg_raster_document_type_supported[] =
++	{
++	  "adobergb-8",
++	  "adobergb-16",
++	  "black-1",
++	  "black-8",
++	  "black-16",
++	  "cmyk-8",
++	  "cmyk-16",
++	  "rgb-8",
++	  "rgb-16",
++	  "sgray-1",
++	  "sgray-8",
++	  "sgray-16",
++	  "srgb-8",
++	  "srgb-16"
++	};
++	ippAddStrings(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
++		      "pwg-raster-document-type-supported",
++		      (int)(sizeof(pwg_raster_document_type_supported) /
++			    sizeof(pwg_raster_document_type_supported[0])), NULL,
++		      pwg_raster_document_type_supported);
++      }
++    }
++  }
++
+  /*
+   * Add name-default attributes...
+   */
+
+From bbc3507a260d29db3fc5601826f33c10f9dccd1e Mon Sep 17 00:00:00 2001
+From: Till Kamppeter <till.kamppeter%gmail.com@localhost>
+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/scheduler/printers.c b/scheduler/printers.c
+index a0ebcbd3e..b5fe9e031 100644
+--- scheduler/printers.c.orig
++++ scheduler/printers.c
+@@ -3765,7 +3765,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));


Home | Main Index | Thread Index | Old Index