Skip to content

Commit

Permalink
eSCL: added quirk_adf_max_pages
Browse files Browse the repository at this point in the history
Some printers fail to properly scan the entire ADF load. In particular:

  * Ricoh MP 501 scans properly few pages, but fails on a full ADF
    load (Issue #356)
  * EPSON WF-2930 consumes all pages from the ADF, but returns image
    only for the first page (Issue #357)

This quirk was added for experimenting with finding workaround for
these problems. If set, it adds scan:NumberOfPages parameter into
the eSCL ScanJobs request.

Note, not all devises properly support this parameter, so users feedback
is required to test this stuff on their hardware.

If these printers will properly handle scan:NumberOfPages, the workaround
is obvious: limit ADF scan with amount of pages that printer can properly
handle, then (automatically) restart the scan, until ADF is empty. It may
slightly slow down the scanning, but at least it will work correctly.

For now, scan:NumberOfPages is hardcoded to "1" for both devices with a
goal to verify the principal possibility of this approach. Other devices
are not affected.
  • Loading branch information
alexpevzner committed Dec 17, 2024
1 parent 794f9f2 commit 54c3c1f
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions airscan-escl.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@
typedef struct {
proto_handler proto; /* Base class */

/* Miscellaneous flags */
bool quirk_localhost; /* Set Host: localhost in ScanJobs rq */
bool quirk_canon_mf410_series; /* Canon MF410 Series */
bool quirk_port_in_host; /* Always set port in Host: header */
bool quirk_next_load_delay; /* Use ESCL_NEXT_LOAD_DELAY */
/* Device-specific quirks */
bool quirk_localhost; /* Set Host: localhost in ScanJobs rq */
bool quirk_canon_mf410_series; /* Canon MF410 Series */
bool quirk_port_in_host; /* Always set port in Host: header */
bool quirk_next_load_delay; /* Use ESCL_NEXT_LOAD_DELAY */
unsigned int quirk_adf_max_pages; /* ADF max pages per job */
} proto_handler_escl;

/* XML namespace for XML writer
Expand Down Expand Up @@ -566,6 +567,12 @@ escl_devcaps_parse (proto_handler_escl *escl,
} else if (!strncasecmp(m, "Brother ", 8)) {
escl->quirk_next_load_delay = true;
}

if (!strcasecmp(m, "EPSON WF-2930 Series")) {
escl->quirk_adf_max_pages = true;
} else if (!strcasecmp(m, "RICOH MP 601")) {
escl->quirk_adf_max_pages = true;
}
} else if (xml_rd_node_name_match(xml, "scan:Manufacturer")) {
const char *m = xml_rd_node_value(xml);

Expand Down Expand Up @@ -843,6 +850,11 @@ escl_scan_query (const proto_ctx *ctx)
xml_wr_add_uint(xml, "scan:YResolution", params->y_res);
if (params->src != ID_SOURCE_PLATEN) {
xml_wr_add_bool(xml, "scan:Duplex", duplex);

if (escl->quirk_adf_max_pages != 0) {
xml_wr_add_uint(xml, "scan:NumberOfPages",
escl->quirk_adf_max_pages);
}
}

/* Send request to device */
Expand Down

0 comments on commit 54c3c1f

Please sign in to comment.