Skip to content

Commit

Permalink
Add smi55357-device-uri/driver Printer Status attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Oct 26, 2023
1 parent dc8e97b commit 5b98e35
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changes in v2.0b1

- Now require libcups v3 or higher.
- Increased `PAPPL_MAX_TYPE` to 128 (Issue #268)
- Added "smi55357-device-uri" and "smi55357-driver" Printer Status attributes
to Get-Printer-Attributes responses.
- Updated APIs to use `size_t` for counts instead of `int`, for compatibility
with libcups v3 (Issue #221)
- Fixed potential crash while listing devices (Issue #296)
Expand Down
14 changes: 11 additions & 3 deletions pappl/printer.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,6 @@ papplPrinterCreate(
// printer-get-attributes-supported
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "printer-get-attributes-supported", NULL, "document-format");

// printer-id
ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-id", printer_id);

// printer-info
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-info", NULL, printer_name);

Expand All @@ -536,6 +533,12 @@ papplPrinterCreate(
// requesting-user-uri-supported
ippAddBoolean(printer->attrs, IPP_TAG_PRINTER, "requesting-user-uri-supported", 1);

// smi55357-device-uri
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "smi55357-device-uri", NULL, printer->device_uri);

// smi55357-driver
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "smi55357-driver", NULL, printer->driver_name);

// uri-security-supported
if (system->options & PAPPL_SOPTIONS_NO_TLS)
ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "uri-security-supported", NULL, "none");
Expand Down Expand Up @@ -564,6 +567,11 @@ papplPrinterCreate(
// Add the printer to the system...
_papplSystemAddPrinter(system, printer, printer_id);

// printer-id
_papplRWLockWrite(printer);
ippAddInteger(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-id", printer->printer_id);
_papplRWUnlock(printer);

// Do any post-creation work...
if (system->create_cb)
(system->create_cb)(printer, system->driver_cbdata);
Expand Down

0 comments on commit 5b98e35

Please sign in to comment.