diff --git a/CHANGES.md b/CHANGES.md index bf3343cc..ceb31ad5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ Changes in v1.4.3 - Fixed missing mutex unlock in DNS-SD code (Issue #299) - Fixed "printer-id" value for new printers (Issue #301) - Fixed DNS-SD device list crash (Issue #302) +- Fixed Set-Printer-Attributes for "output-bin-default" and "sides-default" + (Issue #305) - Fixed default "copies" value with `papplJobCreateWithFile`. diff --git a/pappl/printer-ipp.c b/pappl/printer-ipp.c index 7609bc07..3ec22791 100644 --- a/pappl/printer-ipp.c +++ b/pappl/printer-ipp.c @@ -970,6 +970,7 @@ _papplPrinterSetAttributes( { "media-default", IPP_TAG_KEYWORD, 1 }, { "media-ready", IPP_TAG_KEYWORD, PAPPL_MAX_SOURCE }, { "orientation-requested-default", IPP_TAG_ENUM, 1 }, + { "output-bin-default", IPP_TAG_KEYWORD, 1 }, { "print-color-mode-default", IPP_TAG_KEYWORD, 1 }, { "print-content-optimize-default", IPP_TAG_KEYWORD, 1 }, { "print-darkness-default", IPP_TAG_INTEGER, 1 }, @@ -983,7 +984,8 @@ _papplPrinterSetAttributes( { "printer-organizational-unit", IPP_TAG_TEXT, 1 }, { "printer-resolution-default", IPP_TAG_RESOLUTION, 1 }, { "printer-wifi-password", IPP_TAG_STRING, 1 }, - { "printer-wifi-ssid", IPP_TAG_NAME, 1 } + { "printer-wifi-ssid", IPP_TAG_NAME, 1 }, + { "sides-default", IPP_TAG_KEYWORD, 1 } }; @@ -1119,6 +1121,25 @@ _papplPrinterSetAttributes( driver_data.orient_default = (ipp_orient_t)ippGetInteger(rattr, 0); do_defaults = true; } + else if (!strcmp(name, "output-bin-default")) + { + const char *keyword = ippGetString(rattr, 0, NULL); + // Keyword value + + for (i = 0; i < driver_data.num_bin; i ++) + { + if (!strcmp(keyword, driver_data.bin[i])) + { + driver_data.bin_default = i; + break; + } + } + + if (i >= driver_data.num_bin) + papplClientRespondIPP(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, "Unsupported \"output-bin-default\" value '%s'.", keyword); + else + do_defaults = true; + } else if (!strcmp(name, "print-color-mode-default")) { driver_data.color_default = _papplColorModeValue(ippGetString(rattr, 0, NULL)); @@ -1208,6 +1229,21 @@ _papplPrinterSetAttributes( papplCopyString(wifi_ssid, ippGetString(rattr, 0, NULL), sizeof(wifi_ssid)); do_wifi = true; } + else if (!strcmp(name, "sides-default")) + { + pappl_sides_t sides_default = _papplSidesValue(ippGetString(rattr, 0, NULL)); + // Sides value + + if (!sides_default || !(driver_data.sides_supported & sides_default)) + { + papplClientRespondIPP(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, "Unsupported \"sides-default\" value '%s'.", ippGetString(rattr, 0, NULL)); + } + else + { + driver_data.sides_default = sides_default; + do_defaults = true; + } + } } if (ippGetStatusCode(client->response) != IPP_STATUS_OK)