Skip to content

Commit

Permalink
eSCL: delay between subsequent loads made Brother-specific (closes #347)
Browse files Browse the repository at this point in the history
A while ago, the #3475ee5 change was made, that works around Brother
firmware bug (reported on the MFC-L2710DW model) by introducing a
small delay between subsequent loads when scanning from ADF.

Although implementation of this delay was attempted to be adaptive,
by upper bounding the delay by a fraction of the previously
measured load time, on the very fast high-end devices (namely
HP Color LaserJet Entrprise Flow MFP X677) it effectively halves
the scan speed.

This change makes this delay device-specific.
  • Loading branch information
alexpevzner committed Nov 17, 2024
1 parent 3d3834f commit d2904d9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions airscan-escl.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ typedef struct {
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 */
} proto_handler_escl;

/* XML namespace for XML writer
Expand Down Expand Up @@ -562,6 +563,8 @@ escl_devcaps_parse (proto_handler_escl *escl,
escl->quirk_canon_mf410_series = true;
} else if (!strncasecmp(m, "EPSON ", 6)) {
escl->quirk_port_in_host = true;
} else if (!strncasecmp(m, "Brother ", 8)) {
escl->quirk_next_load_delay = true;
}
} else if (xml_rd_node_name_match(xml, "scan:Manufacturer")) {
const char *m = xml_rd_node_value(xml);
Expand Down Expand Up @@ -959,9 +962,10 @@ escl_load_query (const proto_ctx *ctx)
static proto_result
escl_load_decode (const proto_ctx *ctx)
{
proto_result result = {0};
error err = NULL;
timestamp t = 0;
proto_handler_escl *escl = (proto_handler_escl*) ctx->proto;
proto_result result = {0};
error err = NULL;
timestamp t = 0;

/* Check HTTP status */
err = http_query_error(ctx->query);
Expand All @@ -977,7 +981,7 @@ escl_load_decode (const proto_ctx *ctx)
}

/* Compute delay until next load */
if (ctx->params.src != ID_SOURCE_PLATEN) {
if (escl->quirk_next_load_delay && ctx->params.src != ID_SOURCE_PLATEN) {
t = timestamp_now() - http_query_timestamp(ctx->query);
t *= ESCL_NEXT_LOAD_DELAY_MAX;

Expand Down

0 comments on commit d2904d9

Please sign in to comment.