]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Support face-up printers (Issue #5345)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 28 Sep 2018 15:12:40 +0000 (11:12 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 28 Sep 2018 15:12:40 +0000 (11:12 -0400)
CHANGES.md
cups/ppd-cache.c

index 0055a01f5a204823041b8fca4116440eeb2379d2..d184ca919316a54504ea9d0164b71945ff317a24 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.3b6 - 2018-09-18
+CHANGES - 2.3b6 - 2018-09-28
 ============================
 
 Changes in CUPS v2.3b6
@@ -18,6 +18,8 @@ Changes in CUPS v2.3b6
 - The web interface did not list the IPP Everywhere "driver" (Issue #5338)
 - The scheduler did not report all of the supported job options and values
   (Issue #5340)
+- 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)
index bae64e059e67b0673277d8d6386eaa1b18501984..62a76eb09df6655fe6df4e470747983704e8ea67 100644 (file)
@@ -3929,9 +3929,21 @@ _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 */
+
     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 < count; i ++)
     {
       keyword = ippGetString(attr, i, NULL);
@@ -3945,6 +3957,24 @@ _ppdCreateFromIPP(char   *buffer,        /* I - Filename buffer */
 
       cupsFilePrintf(fp, "*OutputBin %s: \"\"\n", ppdname);
       cupsFilePrintf(fp, "*%s.OutputBin %s/%s: \"\"\n", lang->language, ppdname, msgstr);
+
+      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");
   }