From 1999164de01976ea595a6b4dd69e6d97924c24b2 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 3 Jan 2017 16:42:46 -0500 Subject: [PATCH] Add output-bin support for IPP Everywhere printers (Issue #4938) --- CHANGES.txt | 2 +- cups/ppd-cache.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index fee98d58c..9c535bf4b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,7 +6,7 @@ CHANGES IN CUPS V2.2.2 - Fixed some issues with the Zebra ZPL printer driver (Issue #4898) - Fixed some issues with IPP Everywhere printer support (Issue #4893, Issue #4909, Issue #4916, Issue #4921, Issue #4923, Issue #4932, - Issue #4933) + Issue #4933, Issue #4938) - The cups-lpd program did not catch all legacy usage of ISO-8859-1 (Issue #4899) - Fixed builds on systems without a working poll() implementation diff --git a/cups/ppd-cache.c b/cups/ppd-cache.c index 003180633..a919d21e8 100644 --- a/cups/ppd-cache.c +++ b/cups/ppd-cache.c @@ -3672,6 +3672,79 @@ _ppdCreateFromIPP(char *buffer, /* I - Filename buffer */ } } + /* + * Output bin... + */ + + if ((attr = ippFindAttribute(response, "output-bin-default", IPP_TAG_ZERO)) != NULL) + pwg_ppdize_name(ippGetString(attr, 0, NULL), ppdname, sizeof(ppdname)); + else + strlcpy(ppdname, "Unknown", sizeof(ppdname)); + + if ((attr = ippFindAttribute(response, "outout-bin-supported", IPP_TAG_ZERO)) != NULL && (count = ippGetCount(attr)) > 1) + { + static const char * const output_bins[][2] = + { /* "output-bin" strings */ + { "auto", _("Automatic") }, + { "bottom", _("Bottom Tray") }, + { "center", _("Center Tray") }, + { "face-down", _("Face Down") }, + { "face-up", _("Face Up") }, + { "large-capacity", _("Large Capacity Tray") }, + { "left", _("Left Tray") }, + { "mailbox-1", _("Mailbox 1") }, + { "mailbox-2", _("Mailbox 2") }, + { "mailbox-3", _("Mailbox 3") }, + { "mailbox-4", _("Mailbox 4") }, + { "mailbox-5", _("Mailbox 5") }, + { "mailbox-6", _("Mailbox 6") }, + { "mailbox-7", _("Mailbox 7") }, + { "mailbox-8", _("Mailbox 8") }, + { "mailbox-9", _("Mailbox 9") }, + { "mailbox-10", _("Mailbox 10") }, + { "middle", _("Middle") }, + { "my-mailbox", _("My Mailbox") }, + { "rear", _("Rear Tray") }, + { "right", _("Right Tray") }, + { "side", _("Side Tray") }, + { "stacker-1", _("Stacker 1") }, + { "stacker-2", _("Stacker 2") }, + { "stacker-3", _("Stacker 3") }, + { "stacker-4", _("Stacker 4") }, + { "stacker-5", _("Stacker 5") }, + { "stacker-6", _("Stacker 6") }, + { "stacker-7", _("Stacker 7") }, + { "stacker-8", _("Stacker 8") }, + { "stacker-9", _("Stacker 9") }, + { "stacker-10", _("Stacker 10") }, + { "top", _("Top Tray") }, + { "tray-1", _("Tray 1") }, + { "tray-2", _("Tray 2") }, + { "tray-3", _("Tray 3") }, + { "tray-4", _("Tray 4") }, + { "tray-5", _("Tray 5") }, + { "tray-6", _("Tray 6") }, + { "tray-7", _("Tray 7") }, + { "tray-8", _("Tray 8") }, + { "tray-9", _("Tray 9") }, + { "tray-10", _("Tray 10") } + }; + + cupsFilePrintf(fp, "*OpenUI *OutputBin: PickOne\n" + "*OrderDependency: 10 AnySetup *OutputBin\n" + "*DefaultOutputBin: %s\n", ppdname); + for (i = 0; i < (int)(sizeof(output_bins) / sizeof(output_bins[0])); i ++) + { + if (!ippContainsString(attr, output_bins[i][0])) + continue; + + pwg_ppdize_name(output_bins[i][0], ppdname, sizeof(ppdname)); + + cupsFilePrintf(fp, "*OutputBin %s/%s: \"\"\n", ppdname, _cupsLangString(lang, output_bins[i][1])); + } + cupsFilePuts(fp, "*CloseUI: *OutputBin\n"); + } + /* * Finishing options... */ -- 2.39.2