Skip to content

Commit

Permalink
Address review by Till Kamppeter:
Browse files Browse the repository at this point in the history
- Add mopria-certified and printer-wifi-xxx to list of Printer Description
  attributes.
- Bump the PPD cache version to reflect the additional attributes we are adding.
- Update the documentation to note that DefaultPaperSize and ReadyPaperSizes
  contain a list of PPD size names.
- Update urf-supported/URF values to include copies (CP), finishings (FN), and
  print-quality (PQ) values.
  • Loading branch information
michaelrsweet committed Mar 11, 2021
1 parent 40d7e6e commit 954d47c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 6 deletions.
4 changes: 4 additions & 0 deletions cups/ipp-support.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"document-format-default",
"document-format-details-default",
"document-format-details-supported",
"document-format-preferred", /* AirPrint extension */
"document-format-supported",
"document-format-varying-attributes",
"document-format-version-default",
Expand Down Expand Up @@ -1692,6 +1693,7 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"marker-types", /* CUPS extension */
"member-names", /* CUPS extension */
"member-uris", /* CUPS extension */
"mopria-certified", /* Mopria extension */
"multiple-destination-uris-supported",/* IPP FaxOut */
"multiple-document-jobs-supported",
"multiple-operation-time-out",
Expand Down Expand Up @@ -1769,6 +1771,8 @@ ippCreateRequestedArray(ipp_t *request) /* I - IPP request */
"printer-up-time",
"printer-uri-supported",
"printer-uuid",
"printer-wifi-ssid", /* AirPrint extension */
"printer-wifi-state", /* AirPrint extension */
"printer-xri-supported",
"pwg-raster-document-resolution-supported",
"pwg-raster-document-sheet-back",
Expand Down
1 change: 1 addition & 0 deletions cups/ppd-cache.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* PPD cache implementation for CUPS.
*
* Copyright © 2021 by OpenPrinting.
* Copyright © 2010-2019 by Apple Inc.
*
* Licensed under Apache License v2.0. See the file "LICENSE" for more
Expand Down
3 changes: 2 additions & 1 deletion cups/ppd-private.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Private PPD definitions for CUPS.
*
* Copyright © 2021 by OpenPrinting.
* Copyright © 2007-2019 by Apple Inc.
* Copyright © 1997-2007 by Easy Software Products, all rights reserved.
*
Expand Down Expand Up @@ -35,7 +36,7 @@ extern "C" {
* Constants...
*/

# define _PPD_CACHE_VERSION 9 /* Version number in cache file */
# define _PPD_CACHE_VERSION 10 /* Version number in cache file */


/*
Expand Down
6 changes: 6 additions & 0 deletions doc/help/man-cupsd.conf.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ <h3><a name="TOP_LEVEL_DIRECTIVES">Top-level Directives</a></h3>
<dd style="margin-left: 5.0em">Specifies the default paper size for new print queues. "Auto" uses a locale-specific default, while "None" specifies there is no default paper size.
Specific size names are typically "Letter" or "A4".
The default is "Auto".
Note: The default paper size must use a size name from the PPD file and not a PWG self-describing media size name.
<dt><a name="DefaultPolicy"></a><b>DefaultPolicy </b><i>policy-name</i>
<dd style="margin-left: 5.0em">Specifies the default access policy to use.
The default access policy is "default".
Expand Down Expand Up @@ -238,6 +239,11 @@ <h3><a name="TOP_LEVEL_DIRECTIVES">Top-level Directives</a></h3>
If a numeric value is specified, the job history is preserved for the indicated number of seconds after printing.
If "Yes", the job history is preserved until the MaxJobs limit is reached.
The default is "Yes".
<dt><a name="ReadyPaperSizes"></a><b>ReadyPaperSizes </b><i>sizename[,...]</i>
<dd style="margin-left: 5.0em">Specifies a list of potential paper sizes that are reported as "ready" (loaded).
The actual list will only contain sizes that each printer supports.
The default is "Letter,Legal,Tabloid,4x6,Env10" for North America and "A3,A4,A5,A6,EnvDL" elsewhere.
Note: Paper sizes must use the size names from the PPD file and not PWG self-describing media size names.
<dt><a name="ReloadTimeout"></a><b>ReloadTimeout </b><i>seconds</i>
<dd style="margin-left: 5.0em">Specifies the amount of time to wait for job completion before restarting the scheduler.
The default is "30".
Expand Down
4 changes: 3 additions & 1 deletion man/cupsd.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.\" Licensed under Apache License v2.0. See the file "LICENSE" for more
.\" information.
.\"
.TH cupsd.conf 5 "CUPS" "2021-03-07" "OpenPrinting"
.TH cupsd.conf 5 "CUPS" "2021-03-11" "OpenPrinting"
.SH NAME
cupsd.conf \- server configuration file for cups
.SH DESCRIPTION
Expand Down Expand Up @@ -107,6 +107,7 @@ The default is "en".
Specifies the default paper size for new print queues. "Auto" uses a locale-specific default, while "None" specifies there is no default paper size.
Specific size names are typically "Letter" or "A4".
The default is "Auto".
Note: The default paper size must use a size name from the PPD file and not a PWG self-describing media size name.
.\"#DefaultPolicy
.TP 5
\fBDefaultPolicy \fIpolicy-name\fR
Expand Down Expand Up @@ -376,6 +377,7 @@ The default is "Yes".
Specifies a list of potential paper sizes that are reported as "ready" (loaded).
The actual list will only contain sizes that each printer supports.
The default is "Letter,Legal,Tabloid,4x6,Env10" for North America and "A3,A4,A5,A6,EnvDL" elsewhere.
Note: Paper sizes must use the size names from the PPD file and not PWG self-describing media size names.
.\"#ReloadTimeout
.TP 5
\fBReloadTimeout \fIseconds\fR
Expand Down
29 changes: 25 additions & 4 deletions scheduler/printers.c
Original file line number Diff line number Diff line change
Expand Up @@ -3884,8 +3884,12 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
ipp_attribute_t *media_col_ready, /* media-col-ready attribute */
*media_ready; /* media-ready attribute */
int num_urf; /* Number of urf-supported values */
const char *urf[16]; /* urf-supported values */
char urf_rs[32]; /* RS (resolution) value */
const char *urf[16], /* urf-supported values */
*urf_prefix; /* Prefix string for value */
char *urf_ptr, /* Pointer into value */
urf_fn[64], /* FN (finishings) value */
urf_pq[32], /* PQ (print-quality) value */
urf_rs[32]; /* RS (resolution) value */
static const char * const pwg_raster_document_types[] =
{
"black_1",
Expand Down Expand Up @@ -4102,9 +4106,17 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */

num_urf = 0;
urf[num_urf ++] = "V1.4";
urf[num_urf ++] = "PQ3-4-5";
urf[num_urf ++] = "CP1";
urf[num_urf ++] = "W8";

for (i = 0, urf_ptr = urf_pq, urf_prefix = "PQ"; i < num_qualities; i ++)
{
snprintf(urf_ptr, sizeof(urf_pq) - (size_t)(urf_ptr - urf_pq), "%s%d", prefix, qualities[i]);
urf_prefix = "-";
urf_ptr += strlen(urf_ptr);
}
urf[num_urf ++] = urf_pq;

/*
* Add media options from the PPD file...
*/
Expand Down Expand Up @@ -4645,11 +4657,15 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
{
_pwg_finishings_t *fin; /* Current finishing value */

for (fin = (_pwg_finishings_t *)cupsArrayFirst(p->pc->finishings); fin; fin = (_pwg_finishings_t *)cupsArrayNext(p->pc->finishings))
for (fin = (_pwg_finishings_t *)cupsArrayFirst(p->pc->finishings), urf_ptr = urf_fn, urf_prefix = "FN"; fin; fin = (_pwg_finishings_t *)cupsArrayNext(p->pc->finishings))
{
if (num_finishings < (int)(sizeof(finishings) / sizeof(finishings[0])))
finishings[num_finishings++] = (int)fin->value;

snprintf(urf_ptr, sizeof(urf_fn) - (size_t)(urf_ptr - urf_fn), "%s%d", urf_prefix, fin->value);
urf_prefix = "-";
urf_ptr += strlen(urf_ptr);

switch (fin->value)
{
case IPP_FINISHINGS_BIND :
Expand Down Expand Up @@ -4709,7 +4725,12 @@ load_ppd(cupsd_printer_t *p) /* I - Printer */
break;
}
}

if (urf_ptr > urf_fn)
urf[num_urf ++] = urf_fn;
}
else
urf[num_urf ++] = "FN3";

/* urf-supported */
ippAddStrings(p->ppd_attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "urf-supported", num_urf, NULL, urf);
Expand Down

1 comment on commit 954d47c

@tillkamppeter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You say the default medis-ready is Letter,Legal,... for Northe America and A4,A5,A6,... for elsewhere. You should tell here that the default paper size (A4 or Letter) determines which of the two regions.

Please sign in to comment.