]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
backend/ipp: Fix print-scaling option support for IPP printers
authorZdenek Dohnal <zdohnal@redhat.com>
Fri, 12 Jan 2024 05:55:31 +0000 (06:55 +0100)
committerZdenek Dohnal <zdohnal@redhat.com>
Fri, 12 Jan 2024 05:55:31 +0000 (06:55 +0100)
Fixes #862

CHANGES.md
backend/ipp.c

index 788ada7d8cc8ff2ba3474c916a99bc0fe2bd93e5..39be7d4ce5aa87328df965695dcceb50d51d8543 100644 (file)
@@ -4,18 +4,20 @@ CHANGES - OpenPrinting CUPS 2.4.8 - TBA
 Changes in CUPS v2.4.8 (TBA)
 ----------------------------
 
-- Added additional check on socket if `revents` from `poll()` returns POLLHUP
-  together with POLLIN or POLLOUT in `httpAddrConnect2()` (Issue #839)
-- Added new value for 'lpstat' option '-W' - successfull - for getting
-  successfully printed jobs (Issue #830)
+- Really backport fix for Issue #742
+- Raised `cups_enum_dests()` timeout for listing available IPP printers (Issue #751)
+- Fixed memory leak when unloading a job (Issue #813)
+- Fixed memory leak when creating color profiles (Issue #815)
 - Added warning if the device has to be asked for 'all,media-col-database' separately
   (Issue #829)
+- Added new value for 'lpstat' option '-W' - successfull - for getting
+  successfully printed jobs (Issue #830)
 - Fixed crash in `scan_ps()` if incoming argument is NULL (Issue #831)
-- Fixed memory leak when creating color profiles (Issue #815)
-- Fixed memory leak when unloading a job (Issue #813)
 - Fixed setting job state reasons for successful jobs (Issue #832)
-- Raised `cups_enum_dests()` timeout for listing available IPP printers (Issue #751)
-- Really backport fix for Issue #742
+- Added additional check on socket if `revents` from `poll()` returns POLLHUP
+  together with POLLIN or POLLOUT in `httpAddrConnect2()` (Issue #839)
+- Fixed IPP backend to support the "print-scaling" option with IPP printers
+  (Issue #862)
 
 
 Changes in CUPS v2.4.7 (2023-09-20)
index be1f2c048143fa697075f7abd62178585671f978..b2213746b844ea9145dee2744a8536ce6b12a190 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IPP backend for CUPS.
  *
- * Copyright © 2021-2023 by OpenPrinting
+ * Copyright © 2021-2024 by OpenPrinting
  * Copyright © 2007-2021 by Apple Inc.
  * Copyright © 1997-2007 by Easy Software Products, all rights reserved.
  *
@@ -111,6 +111,7 @@ static const char * const pattrs[] =        /* Printer attributes we want */
   "multiple-document-handling-supported",
   "operations-supported",
   "print-color-mode-supported",
+  "print-scaling-supported",
   "printer-alert",
   "printer-alert-description",
   "printer-is-accepting-jobs",
@@ -163,7 +164,8 @@ static ipp_t                *new_request(ipp_op_t op, int version, const char *uri,
                                     ppd_file_t *ppd,
                                     ipp_attribute_t *media_col_sup,
                                     ipp_attribute_t *doc_handling_sup,
-                                    ipp_attribute_t *print_color_mode_sup);
+                                    ipp_attribute_t *print_color_mode_sup,
+                                    ipp_attribute_t *print_scaling_sup);
 static const char      *password_cb(const char *prompt, http_t *http,
                                     const char *method, const char *resource,
                                     int *user_data);
@@ -251,6 +253,7 @@ main(int  argc,                             /* I - Number of command-line args */
   ipp_attribute_t *printer_state;      /* printer-state attribute */
   ipp_attribute_t *printer_accepting;  /* printer-is-accepting-jobs */
   ipp_attribute_t *print_color_mode_sup;/* Does printer support print-color-mode? */
+  ipp_attribute_t *print_scaling_sup;  /* print-scaling-supported */
   int          create_job = 0,         /* Does printer support Create-Job? */
                get_job_attrs = 0,      /* Does printer support Get-Job-Attributes? */
                send_document = 0,      /* Does printer support Send-Document? */
@@ -893,6 +896,7 @@ main(int  argc,                             /* I - Number of command-line args */
   operations_sup       = NULL;
   doc_handling_sup     = NULL;
   print_color_mode_sup = NULL;
+  print_scaling_sup    = NULL;
 
   do
   {
@@ -1163,6 +1167,15 @@ main(int  argc,                          /* I - Number of command-line args */
 
     print_color_mode_sup = ippFindAttribute(supported, "print-color-mode-supported", IPP_TAG_KEYWORD);
 
+    if ((print_scaling_sup = ippFindAttribute(supported, "print-scaling-supported", IPP_TAG_KEYWORD)) != NULL)
+    {
+      int count = ippGetCount(print_scaling_sup);
+
+      fprintf(stderr, "DEBUG: print-scaling-supported (%d values)\n", count);
+      for (i = 0; i < count; i ++)
+        fprintf(stderr, "DEBUG: [%d] = %s\n", i, ippGetString(print_scaling_sup, i, NULL));
+    }
+
     if ((operations_sup = ippFindAttribute(supported, "operations-supported",
                                           IPP_TAG_ENUM)) != NULL)
     {
@@ -1474,7 +1487,7 @@ main(int  argc,                           /* I - Number of command-line args */
     request = new_request(IPP_OP_VALIDATE_JOB, version, uri, argv[2],
                           monitor.job_name, num_options, options, compression,
                          copies_sup ? copies : 1, document_format, pc, ppd,
-                         media_col_sup, doc_handling_sup, print_color_mode_sup);
+                         media_col_sup, doc_handling_sup, print_color_mode_sup, print_scaling_sup);
 
     response = cupsDoRequest(http, request, resource);
 
@@ -1597,7 +1610,7 @@ main(int  argc,                           /* I - Number of command-line args */
                          version, uri, argv[2], monitor.job_name, num_options,
                          options, compression, copies_sup ? copies : 1,
                          document_format, pc, ppd, media_col_sup,
-                         doc_handling_sup, print_color_mode_sup);
+                         doc_handling_sup, print_color_mode_sup, print_scaling_sup);
 
    /*
     * Do the request...
@@ -2799,8 +2812,9 @@ new_request(
     ppd_file_t      *ppd,              /* I - PPD file data */
     ipp_attribute_t *media_col_sup,    /* I - media-col-supported values */
     ipp_attribute_t *doc_handling_sup,  /* I - multiple-document-handling-supported values */
-    ipp_attribute_t *print_color_mode_sup)
-                                       /* I - Printer supports print-color-mode */
+    ipp_attribute_t *print_color_mode_sup,
+                                       /* I - Printer supports print-color-mode? */
+    ipp_attribute_t *print_scaling_sup)        /* I - print-scaling-supported values */
 {
   ipp_t                *request;               /* Request data */
   const char   *keyword;               /* PWG keyword */
@@ -2867,6 +2881,9 @@ new_request(
 
       copies = _cupsConvertOptions(request, ppd, pc, media_col_sup, doc_handling_sup, print_color_mode_sup, user, format, copies, num_options, options);
 
+      if ((keyword = cupsGetOption("print-scaling", num_options, options)) != NULL && ippContainsString(print_scaling_sup, keyword))
+        ippAddString(request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "print-scaling", NULL, keyword);
+
      /*
       * Map FaxOut options...
       */