Skip to content

Commit

Permalink
Merge pull request #599 from tillkamppeter/master
Browse files Browse the repository at this point in the history
PPD for driverless IPP: Poll "media-col-database" separately if needed
  • Loading branch information
michaelrsweet committed Jan 29, 2023
2 parents e04821c + ecfb030 commit c0e0e07
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions scheduler/ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5385,6 +5385,43 @@ create_local_bg_thread(
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: IPP/1.1 Get-Printer-Attributes returned %s (%s)", printer->name, ippErrorString(cupsLastError()), cupsLastErrorString());
}

/*
* If we did not succeed to obtain the "media-col-database" attribute
* try to get it separately
*/
if (ippFindAttribute(response, "media-col-database", IPP_TAG_ZERO) ==
NULL)
{
ipp_t *response2;

cupsdLogMessage(CUPSD_LOG_DEBUG,
"Polling \"media-col-database\" attribute separately.");
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippSetVersion(request, 2, 0);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "media-col-database");
response2 = cupsDoRequest(http, request, resource);
//ipp_status = cupsLastError();
if (response2)
{
if ((attr = ippFindAttribute(response2, "media-col-database",
IPP_TAG_ZERO)) != NULL)
{
/*
* Copy "media-col-database" attribute into the original
* IPP response
*/

cupsdLogMessage(CUPSD_LOG_DEBUG,
"\"media-col-database\" attribute found.");
ippCopyAttribute(response, attr, 0);
}
ippDelete(response2);
}
}

// TODO: Grab printer icon file...
httpClose(http);

Expand Down

0 comments on commit c0e0e07

Please sign in to comment.