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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
From 42a493bcbf60eb0f2e190f3022ac26358eb702f3 Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
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 7aa7bd8f2..cfa88f002 100644
--- a/scheduler/printers.c
+++ b/scheduler/printers.c
@@ -2178,9 +2178,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,
@@ -2517,6 +2518,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...
*/
|