]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Turn off duplex if validate-job says it can't be done.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 13 Jun 2018 18:32:16 +0000 (14:32 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 13 Jun 2018 18:32:16 +0000 (14:32 -0400)
backend/ipp.c

index aa9d09a9fbdf933aca7411eeb5c3587c06f2c989..a0c386540d3ceb961cd3ebfdc7618d3f4cc04a74 100644 (file)
@@ -1485,6 +1485,30 @@ main(int  argc,                          /* I - Number of command-line args */
                                   ippGetString(job_auth, 0, NULL), num_options,
                                   &options);
 
+    if (ipp_status == IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED || ipp_status == IPP_STATUS_OK_CONFLICTING)
+    {
+     /*
+      * One or more options are not supported...
+      */
+
+      ipp_attribute_t  *attr;          /* Unsupported attribute */
+
+      if ((attr = ippFindAttribute(response, "sides", IPP_TAG_ZERO)) != NULL)
+      {
+       /*
+        * The sides value is not supported, revert to one-sided as needed...
+        */
+
+        const char *sides = cupsGetOption("sides", num_options, options);
+
+        if (!strncmp(sides, "two-sided-", 10))
+        {
+          fputs("DEBUG: Unable to do two-sided printing, setting sides to 'one-sided'.\n", stderr);
+          num_options = cupsAddOption("sides", "one-sided", num_options, &options);
+        }
+      }
+    }
+
     ippDelete(response);
 
     if (job_canceled)