Skip to content

Commit

Permalink
driverless: Removed the support quality check
Browse files Browse the repository at this point in the history
(cherry picked from commit 3fddcf5)
  • Loading branch information
tillkamppeter committed Jan 7, 2021
1 parent a6807df commit aae86d2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 44 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ NEWS - OpenPrinting CUPS Filters v1.28.6 - 2020-12-02

CHANGES IN V1.28.7

- driverless: Removed the support quality check from Pull
request #235 as it takes significant time for each printer
being listed, making cups-driverd (`lpinfo -m`) timing out
when there are many printers (OP CUPS Issue #65).
- libcupsfilters: In the PPD generator give priority to Apple
Raster against PDF (Issue #331).
- libcupsfilters: Added NULL check when removing ".Borderless"
Expand Down
8 changes: 0 additions & 8 deletions cupsfilters/ipp.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ enum driverless_support_modes {
DRVLESS_INCOMPLETEIPP /* Driverless support without media-col-database attribute */
};

/* Array of text strings explaining available driverless support */
const char * driverless_support_strs[] = {
"driverless - cannot check driverless status",
"fully driverless",
"driverless via IPP 1.1",
"driverless with incomplete IPP request"
};

int check_driverless_support(const char* uri);
ipp_t *get_printer_attributes(const char* raw_uri,
const char* const pattrs[],
Expand Down
45 changes: 9 additions & 36 deletions utils/driverless.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ convert_to_port(char *a)
void
listPrintersInArray(int reg_type_no, int mode, int isFax,
char* ippfind_output) {
int driverless_support = 0, /*process id for ippfind */
port,
int port,
is_local;
char buffer[8192], /* Copy buffer */
*ptr, /* Pointer into string */
Expand All @@ -88,7 +87,6 @@ listPrintersInArray(int reg_type_no, int mode, int isFax,
make[512], /* Manufacturer */
model[256], /* Model */
pdl[256], /* PDL */
driverless_info[256], /* Driverless info string */
device_id[2048]; /* 1284 device ID */

service_uri = (char *)malloc(2048*(sizeof(char)));
Expand Down Expand Up @@ -324,57 +322,32 @@ listPrintersInArray(int reg_type_no, int mode, int isFax,
else
strncpy(make_and_model, model, sizeof(make_and_model) - 1);

/* Check which driverless support is available for the found device:
* 0) DRVLESS_CHECKERR - the device failed to respond to any
* get-printer-attributes request versions available.
* 1) FULL_DRVLESS - the device responded correctly to IPP 2.0
* get-printer-attributes request.
* The device is compatible with CUPS 'everywhere' model.
* 2) DRVLESS_IPP11 - the device responded correctly to IPP 1.1
* get-printer-attributes request.
* 3) DRVLESS_INCOMPLETEIPP - the device responded correctly to IPP
* get-printer-attributes request without media-col-database
* attribute
*
* If we know which driverless support is available, we can divide
* which devices can be supported by CUPS temporary queues and which
* devices need cups-browsed to run.
*/
driverless_support = check_driverless_support(service_uri);

if (driverless_support == DRVLESS_CHECKERR)
fprintf(stderr, "Failed to get info about driverless support.\n");

snprintf(driverless_info, 255, "%s",
driverless_support_strs[driverless_support]);
driverless_info[255] = '\0';

if (mode == 1) {
/* Only output the entry if we had this UUID not already */
if (!txt_uuid[0] || !cupsArrayFind(uuids, txt_uuid)) {
/* Save UUID as if an entry with the same UUID appears again, it
is the the same pair of print and fax PPDs */
if (txt_uuid[0]) cupsArrayAdd(uuids, strdup(txt_uuid));
/* Call with "list" argument (PPD generator in list mode) */
printf("\"%s%s\" en \"%s\" \"%s, %s%s, cups-filters " VERSION
"\" \"%s\"\n",
printf("\"%s%s\" en \"%s\" \"%s, %sdriverless, cups-filters "
VERSION "\" \"%s\"\n",
((isFax) ? "driverless-fax:" : "driverless:"),
service_uri, make, make_and_model,
((isFax) ? "Fax, " : ""),
driverless_info, device_id);
device_id);
if (resource[0]) /* We have also fax on this device */
printf("\"%s%s\" en \"%s\" \"%s, Fax, %s, cups-filters " VERSION
"\" \"%s\"\n",
printf("\"%s%s\" en \"%s\" \"%s, Fax, driverless, cups-filters "
VERSION "\" \"%s\"\n",
"driverless-fax:",
service_uri, make, make_and_model,
driverless_info, device_id);
device_id);
}
} else {
/* Call without arguments and env variable "SOFTWARE" starting
with "CUPS" (Backend in discovery mode) */
printf("network %s \"%s\" \"%s (%s)\" \"%s\" \"\"\n",
printf("network %s \"%s\" \"%s (driverless)\" \"%s\" \"\"\n",
service_uri, make_and_model, make_and_model,
driverless_info, device_id);
device_id);
}
}

Expand Down

0 comments on commit aae86d2

Please sign in to comment.