Skip to content

Commit

Permalink
Update the printer-settable-attributes-supported values (Issue michae…
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Nov 30, 2023
1 parent 90b6496 commit 2d25c1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ Changes in v2.0b1
- Fixed "printer-id" value for new printers (Issue #301)
- Fixed Set-Printer-Attributes for "output-bin-default" and "sides-default"
(Issue #305)
- Fixed "printer-settable-attributes-supported" value (Issue #311)
- Fixed `-n` support for setting number of copies (Issue #312)
- Fixed default "copies" value with `papplJobCreateWithFile`.
8 changes: 6 additions & 2 deletions pappl/printer-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ make_attrs(
static const char * const printer_settable_attributes[] =
{ // printer-settable-attributes values
"copies-default",
"document-format-default",
"media-col-default",
"media-col-ready",
"media-default",
Expand All @@ -461,6 +460,7 @@ make_attrs(
"print-color-mode-default",
"print-content-optimize-default",
"print-quality-default",
"printer-contact-col",
"printer-geo-location",
"printer-location",
"printer-organization",
Expand Down Expand Up @@ -1076,12 +1076,14 @@ make_attrs(

// printer-settable-attributes
memcpy((void *)svalues, printer_settable_attributes, sizeof(printer_settable_attributes));
num_values = (int)(sizeof(printer_settable_attributes) / sizeof(printer_settable_attributes[0]));
num_values = sizeof(printer_settable_attributes) / sizeof(printer_settable_attributes[0]);

if (data->mode_supported)
svalues[num_values ++] = "label-mode-configured";
if (data->tear_offset_supported[1])
svalues[num_values ++] = "label-tear-off-configured";
if (data->num_bin)
svalues[num_values ++] = "output-bin-default";
if (data->darkness_supported)
svalues[num_values ++] = "print-darkness-default";
if (data->speed_supported[1])
Expand All @@ -1093,6 +1095,8 @@ make_attrs(
svalues[num_values ++] = "printer-wifi-password";
svalues[num_values ++] = "printer-wifi-ssid";
}
if (data->sides_supported != PAPPL_SIDES_ONE_SIDED)
svalues[num_values ++] = "sides-default";
for (i = 0; i < (size_t)data->num_vendor && num_values < (int)(sizeof(svalues) / sizeof(svalues[0])); i ++)
{
snprintf(vvalues[i], sizeof(vvalues[0]), "%s-default", data->vendor[i]);
Expand Down

0 comments on commit 2d25c1d

Please sign in to comment.