OpenPrinting / pappl-retrofit

PPD/Classic CUPS driver retro-fit Printer Application Library
Apache License 2.0
7 stars 10 forks source link

Driverless PPD cannot list vendor options #10

Closed szlt5 closed 5 months ago

szlt5 commented 1 year ago

I added a printer named "canon_MF745" on the legacy-printer-app's web UI page, and the printer's corresponding driver is from CNRCUPSMF745CZK.ppd. CNRCUPSMF745CZK.ppd.txt

The "canon_MF745" is an emulator IPP device, so I used the ipptool to get the "canon_MF745" 's IPP attributes. ipptool -tv ipp://ubuntu.local:8003/ipp/print/canon_MF745 get-printer-attributes-3.0.test get_printer_attributes-3.0.log

On cups side, the driverless printer "canon_MF745" is auto added, but the driverless has few user settable-options to set. For example, the "toner-save" option is listed on the legacy-printer-app's web UI page and it is also available via the IPP protocol, but the driverless cannot show it.

toner-save-supported (1setOf keyword) = automatic-selection,auto,on,off
toner-save-default (keyword) = automatic-selection

How can these vendor options be displayed on driverless? In the process of generating driverless, is it possible to read the "job-creation-attributes-supported" attribute first, from the "job-creation-attributes-supported" value, we can get some vendor options' names (e.g toner-save), and then the driverless can list the vendor options according to these names (e.g toner-save-supported & toner-save-default)?

BTW, another two points: (1) cpdb-cups has the same issue, the get_printer_option only lists fixed options, the vendor-options are not listed. cpdb-cups_get_options.log

(2) It's weird, the get-printer-attributes-3.0.test can get the vendor options, but the get-printer-attributes-2.0.test could not get the vendor options. get_printer_attributes-2.0.log

szlt5 commented 1 year ago

(1) cpdb-cups has the same issue, the get_printer_option only lists fixed options, the vendor-options are not listed.

About the cpdb-cups, I did trial based on the cpdb-cups source: change the IPP server from cups (localhost:631) to legacy_printer_app (localhost:8003), then cups_get_all_printers() returns all the printers added on the legacy_printer_app web UI; and the get_printer_option() can list vendor-options. (Notes: my trial has bugs, the vendor option's selection cannot retrieved, please ignore the bug)

trial_get_all_option.log

I am confused now, if each vendor supplies their own back-ends named cpdb-hp-backend or cpdb-canon-backend to connected with hp-printer-app/canon-printer-app, do we still need cups? are CUPS just used to create driverless printers for real IPP device?

szlt5 commented 1 year ago

(2) It's weird, the get-printer-attributes-3.0.test can get the vendor options, but the get-printer-attributes-2.0.test could not get the vendor options.

I read the source today, the weird phenomenon is a bug, is it? For the get-printer-attributes-3.0.test the requested-attributes (keyword) = all, at this moment, the ra is NULL, and all the printer->attrs and printer->driver_attrs are outputted to client.

void
_papplPrinterCopyAttributesNoLock(
    pappl_printer_t *printer,       // I - Printer
    pappl_client_t  *client,        // I - Client
    cups_array_t    *ra,        // I - Requested attributes
    const char      *format)        // I - "document-format" value, if any
{
    cups_len_t  i,          // Looping var
        num_values;     // Number of values
    unsigned    bit;            // Current bit value
    const char  *svalues[100];      // String values
    int     ivalues[100];       // Integer values
    pappl_pr_driver_data_t *data = &printer->driver_data;
    // Driver data
    const char  *webscheme = (httpAddrIsLocalhost(httpGetAddress(client->http)) || !papplSystemGetTLSOnly(client->system)) ? "http" : "https";
    // URL scheme for resources

    _papplCopyAttributes(client->response, printer->attrs, ra, IPP_TAG_ZERO, IPP_TAG_CUPS_CONST);
    _papplCopyAttributes(client->response, printer->driver_attrs, ra, IPP_TAG_ZERO, IPP_TAG_CUPS_CONST);

For the get-printer-attributes-2.0.test, the requested-attributes (1setOf keyword) = all,media-col-database, at this moment the ra is the collection/set of several IPP attributes recorded in the ippCreateRequestedArray(), so the printer->attrs & printer->driver_attrs are filtered before outputting to client.

szlt5 commented 1 year ago

What I'm looking for is whether there is a way for users to set vendor options on the application UI. I think it is inconvenient to set the vendor option on printer-app's Web UI before opening an application to print.

szlt5 commented 5 months ago

No replay, close.