Skip to content

Commit c0e0e07

Browse files
Merge pull request #599 from tillkamppeter/master
PPD for driverless IPP: Poll "media-col-database" separately if needed
2 parents e04821c + ecfb030 commit c0e0e07

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

scheduler/ipp.c

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5385,6 +5385,43 @@ create_local_bg_thread(
53855385
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: IPP/1.1 Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString());
53865386
}
53875387

5388+
/*
5389+
* If we did not succeed to obtain the "media-col-database" attribute
5390+
* try to get it separately
5391+
*/
5392+
if (ippFindAttribute(response, "media-col-database", IPP_TAG_ZERO) ==
5393+
NULL)
5394+
{
5395+
ipp_t *response2;
5396+
5397+
cupsdLogMessage(CUPSD_LOG_DEBUG,
5398+
"Polling \"media-col-database\" attribute separately.");
5399+
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
5400+
ippSetVersion(request, 2, 0);
5401+
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
5402+
"printer-uri", NULL, uri);
5403+
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
5404+
"requested-attributes", NULL, "media-col-database");
5405+
response2 = cupsDoRequest(http, request, resource);
5406+
//ipp_status = cupsLastError();
5407+
if (response2)
5408+
{
5409+
if ((attr = ippFindAttribute(response2, "media-col-database",
5410+
IPP_TAG_ZERO)) != NULL)
5411+
{
5412+
/*
5413+
* Copy "media-col-database" attribute into the original
5414+
* IPP response
5415+
*/
5416+
5417+
cupsdLogMessage(CUPSD_LOG_DEBUG,
5418+
"\"media-col-database\" attribute found.");
5419+
ippCopyAttribute(response, attr, 0);
5420+
}
5421+
ippDelete(response2);
5422+
}
5423+
}
5424+
53885425
// TODO: Grab printer icon file...
53895426
httpClose(http);
53905427

0 commit comments

Comments
 (0)