]>
Commit | Line | Data |
---|---|---|
ba7599c9 AM |
1 | --- a/backend/ipp.c |
2 | +++ b/backend/ipp.c | |
3 | @@ -62,7 +62,8 @@ | |
4 | *resource; /* Resource path */ | |
5 | int port, /* Port number */ | |
6 | version, /* IPP version */ | |
7 | - job_id; /* Job ID for submitted job */ | |
8 | + job_id, /* Job ID for submitted job */ | |
9 | + get_job_attrs; /* Support Get-Job-Attributes? */ | |
10 | const char *job_name; /* Job name for submitted job */ | |
11 | http_encryption_t encryption; /* Use encryption? */ | |
12 | ipp_jstate_t job_state; /* Current job state */ | |
13 | @@ -237,6 +238,7 @@ | |
14 | ipp_attribute_t *printer_state; /* printer-state attribute */ | |
15 | ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */ | |
16 | int create_job = 0, /* Does printer support Create-Job? */ | |
17 | + get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */ | |
18 | send_document = 0, /* Does printer support Send-Document? */ | |
19 | validate_job = 0; /* Does printer support Validate-Job? */ | |
20 | int copies, /* Number of copies for job */ | |
21 | @@ -1065,13 +1067,18 @@ | |
22 | create_job = 1; | |
23 | else if (operations_sup->values[i].integer == IPP_SEND_DOCUMENT) | |
24 | send_document = 1; | |
25 | + else if (operations_sup->values[i].integer == IPP_GET_JOB_ATTRIBUTES) | |
26 | + get_job_attrs = 1; | |
27 | } | |
28 | ||
29 | - if (!send_document) | |
30 | + if (create_job && !send_document) | |
31 | { | |
32 | fputs("DEBUG: Printer supports Create-Job but not Send-Document.\n", | |
33 | stderr); | |
34 | create_job = 0; | |
35 | + | |
36 | + update_reasons(NULL, "+cups-ipp-conformance-failure-report," | |
37 | + "cups-ipp-missing-send-document"); | |
38 | } | |
39 | ||
40 | if (!validate_job) | |
41 | @@ -1255,6 +1262,7 @@ | |
42 | monitor.port = port; | |
43 | monitor.version = version; | |
44 | monitor.job_id = 0; | |
45 | + monitor.get_job_attrs = get_job_attrs; | |
46 | monitor.encryption = cupsEncryption(); | |
47 | monitor.job_state = IPP_JOB_PENDING; | |
48 | monitor.printer_state = IPP_PRINTER_IDLE; | |
49 | @@ -1298,6 +1306,8 @@ | |
50 | _cupsLangPrintFilter(stderr, "INFO", _("The printer is busy.")); | |
51 | sleep(10); | |
52 | } | |
53 | + else if (ipp_status == IPP_DOCUMENT_FORMAT) | |
54 | + goto cleanup; | |
55 | else if (ipp_status == IPP_FORBIDDEN || | |
56 | ipp_status == IPP_AUTHENTICATION_CANCELED) | |
57 | { | |
58 | @@ -1652,7 +1662,7 @@ | |
59 | * Wait for the job to complete... | |
60 | */ | |
61 | ||
62 | - if (!job_id || !waitjob) | |
63 | + if (!job_id || !waitjob || !get_job_attrs) | |
64 | continue; | |
65 | ||
66 | _cupsLangPrintFilter(stderr, "INFO", _("Waiting for job to complete.")); | |
67 | @@ -1695,7 +1705,7 @@ | |
68 | response = cupsDoRequest(http, request, resource); | |
69 | ipp_status = cupsLastError(); | |
70 | ||
71 | - if (ipp_status == IPP_NOT_FOUND) | |
72 | + if (ipp_status == IPP_NOT_FOUND || ipp_status == IPP_NOT_POSSIBLE) | |
73 | { | |
74 | /* | |
75 | * Job has gone away and/or the server has no job history... | |
76 | @@ -1717,7 +1727,6 @@ | |
77 | else | |
78 | { | |
79 | if (ipp_status != IPP_SERVICE_UNAVAILABLE && | |
80 | - ipp_status != IPP_NOT_POSSIBLE && | |
81 | ipp_status != IPP_PRINTER_BUSY) | |
82 | { | |
83 | ippDelete(response); | |
84 | @@ -1865,12 +1874,18 @@ | |
85 | return (CUPS_BACKEND_AUTH_REQUIRED); | |
86 | else if (ipp_status == IPP_INTERNAL_ERROR) | |
87 | return (CUPS_BACKEND_STOP); | |
88 | - else if (ipp_status == IPP_DOCUMENT_FORMAT || | |
89 | - ipp_status == IPP_CONFLICT) | |
90 | + else if (ipp_status == IPP_CONFLICT) | |
91 | return (CUPS_BACKEND_FAILED); | |
92 | - else if (ipp_status == IPP_REQUEST_VALUE) | |
93 | + else if (ipp_status == IPP_REQUEST_VALUE || | |
94 | + ipp_status == IPP_DOCUMENT_FORMAT || job_canceled < 0) | |
95 | { | |
96 | - _cupsLangPrintFilter(stderr, "ERROR", _("Print job too large.")); | |
97 | + if (ipp_status == IPP_REQUEST_VALUE) | |
98 | + _cupsLangPrintFilter(stderr, "ERROR", _("Print job too large.")); | |
99 | + else if (ipp_status == IPP_DOCUMENT_FORMAT) | |
100 | + _cupsLangPrintFilter(stderr, "ERROR", | |
101 | + _("Printer cannot print supplied content.")); | |
102 | + else | |
103 | + _cupsLangPrintFilter(stderr, "ERROR", _("Print job canceled at printer.")); | |
104 | return (CUPS_BACKEND_CANCEL); | |
105 | } | |
106 | else if (ipp_status > IPP_OK_CONFLICT && ipp_status != IPP_ERROR_JOB_CANCELED) | |
107 | @@ -2116,7 +2131,8 @@ | |
108 | * Check the status of the job itself... | |
109 | */ | |
110 | ||
111 | - job_op = monitor->job_id > 0 ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS; | |
112 | + job_op = (monitor->job_id > 0 && monitor->get_job_attrs) ? | |
113 | + IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS; | |
114 | request = ippNewRequest(job_op); | |
115 | request->request.op.version[0] = monitor->version / 10; | |
116 | request->request.op.version[1] = monitor->version % 10; | |
117 | @@ -2306,7 +2322,7 @@ | |
118 | fprintf(stderr, "DEBUG: job-name=\"%s\"\n", title); | |
119 | } | |
120 | ||
121 | - if (format) | |
122 | + if (format && op != IPP_CREATE_JOB) | |
123 | { | |
124 | ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, | |
125 | "document-format", NULL, format); | |
126 | @@ -2314,7 +2330,7 @@ | |
127 | } | |
128 | ||
129 | #ifdef HAVE_LIBZ | |
130 | - if (compression) | |
131 | + if (compression && op != IPP_CREATE_JOB) | |
132 | { | |
133 | ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, | |
134 | "compression", NULL, compression); | |
135 | --- a/scheduler/printers.c | |
136 | +++ b/scheduler/printers.c | |
137 | @@ -4233,6 +4233,41 @@ | |
138 | } | |
139 | ||
140 | /* | |
141 | + * media-size-supported | |
142 | + */ | |
143 | + | |
144 | + num_media = p->pc->num_sizes; | |
145 | + if (p->pc->custom_min_keyword) | |
146 | + num_media ++; | |
147 | + | |
148 | + if ((attr = ippAddCollections(p->ppd_attrs, IPP_TAG_PRINTER, | |
149 | + "media-size-supported", num_media, | |
150 | + NULL)) != NULL) | |
151 | + { | |
152 | + val = attr->values; | |
153 | + | |
154 | + for (i = p->pc->num_sizes, pwgsize = p->pc->sizes; | |
155 | + i > 0; | |
156 | + i --, pwgsize ++, val ++) | |
157 | + { | |
158 | + val->collection = ippNew(); | |
159 | + ippAddInteger(val->collection, IPP_TAG_PRINTER, IPP_TAG_INTEGER, | |
160 | + "x-dimension", pwgsize->width); | |
161 | + ippAddInteger(val->collection, IPP_TAG_PRINTER, IPP_TAG_INTEGER, | |
162 | + "y-dimension", pwgsize->length); | |
163 | + } | |
164 | + | |
165 | + if (p->pc->custom_min_keyword) | |
166 | + { | |
167 | + val->collection = ippNew(); | |
168 | + ippAddRange(val->collection, IPP_TAG_PRINTER, "x-dimension", | |
169 | + p->pc->custom_min_width, p->pc->custom_max_width); | |
170 | + ippAddRange(val->collection, IPP_TAG_PRINTER, "y-dimension", | |
171 | + p->pc->custom_min_length, p->pc->custom_max_length); | |
172 | + } | |
173 | + } | |
174 | + | |
175 | + /* | |
176 | * media-source-supported | |
177 | */ | |
178 | ||
179 | @@ -5145,6 +5180,8 @@ | |
180 | message = "Printer does not support REQUIRED Validate-Job operation."; | |
181 | else if (!strcmp(reason, "missing-get-printer-attributes")) | |
182 | message = "Printer does not support REQUIRED Get-Printer-Attributes operation."; | |
183 | + else if (!strcmp(reason, "missing-send-document")) | |
184 | + message = "Printer supports Create-Job but not Send-Document operation."; | |
185 | else if (!strcmp(reason, "missing-job-history")) | |
186 | message = "Printer does not provide REQUIRED job history."; | |
187 | else if (!strcmp(reason, "missing-job-id")) |