Skip to content

Commit

Permalink
Support face-up printers (Issue #5345)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 28, 2018
1 parent b485551 commit fe1fac1
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CHANGES - 2.2.9 - 2018-09-18
CHANGES - 2.2.9 - 2018-09-28
============================


Expand All @@ -16,6 +16,8 @@ Changes in CUPS v2.2.9
- Fixed a crash bug in the Epson dot matrix driver (Issue #5323)
- Automatic debug logging of job errors did not work with systemd (Issue #5337)
- The web interface did not list the IPP Everywhere "driver" (Issue #5338)
- The IPP Everywhere "driver" now properly supports face-up printers
(Issue #5345)
- Fixed some typos in the label printer drivers (Issue #5350)
- The IPP Everywhere "driver" no longer does local filtering when printing to
a shared CUPS printer (Issue #5361)
Expand Down
29 changes: 29 additions & 0 deletions cups/ppd-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -3790,6 +3790,12 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */

if ((attr = ippFindAttribute(response, "output-bin-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1)
{
ipp_attribute_t *trays = ippFindAttribute(response, "printer-output-tray", IPP_TAG_STRING);
/* printer-output-tray attribute, if any */
const char *tray_ptr; /* printer-output-tray value */
int tray_len; /* Len of printer-output-tray value */
char tray[IPP_MAX_OCTETSTRING];
/* printer-output-tray string value */
static const char * const output_bins[][2] =
{ /* "output-bin" strings */
{ "auto", _("Automatic") },
Expand Down Expand Up @@ -3840,6 +3846,11 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */
cupsFilePrintf(fp, "*OpenUI *OutputBin: PickOne\n"
"*OrderDependency: 10 AnySetup *OutputBin\n"
"*DefaultOutputBin: %s\n", ppdname);
if (!strcmp(ppdname, "FaceUp"))
cupsFilePuts(fp, "*DefaultOutputOrder: Reverse\n");
else
cupsFilePuts(fp, "*DefaultOutputOrder: Normal\n");

for (i = 0; i < (int)(sizeof(output_bins) / sizeof(output_bins[0])); i ++)
{
if (!ippContainsString(attr, output_bins[i][0]))
Expand All @@ -3849,6 +3860,24 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */

cupsFilePrintf(fp, "*OutputBin %s: \"\"\n", ppdname);
cupsFilePrintf(fp, "*%s.OutputBin %s/%s: \"\"\n", lang->language, ppdname, _cupsLangString(lang, output_bins[i][1]));

if ((tray_ptr = ippGetOctetString(trays, i, &tray_len)) != NULL)
{
if (tray_len >= (int)sizeof(tray))
tray_len = (int)sizeof(tray) - 1;

memcpy(tray, tray_ptr, tray_len);
tray[tray_len] = '\0';

if (strstr(tray, "stackingorder=lastToFirst;"))
cupsFilePrintf(fp, "*PageStackOrder %s: Reverse\n", ppdname);
else
cupsFilePrintf(fp, "*PageStackOrder %s: Normal\n", ppdname);
}
else if (!strcmp(ppdname, "FaceUp"))
cupsFilePrintf(fp, "*PageStackOrder %s: Reverse\n", ppdname);
else
cupsFilePrintf(fp, "*PageStackOrder %s: Normal\n", ppdname);
}
cupsFilePuts(fp, "*CloseUI: *OutputBin\n");
}
Expand Down

0 comments on commit fe1fac1

Please sign in to comment.