From d2904d958f63b5f961c0c7c6e39d26b132852ad7 Mon Sep 17 00:00:00 2001 From: Alexander Pevzner Date: Sun, 17 Nov 2024 20:43:08 +0300 Subject: [PATCH] eSCL: delay between subsequent loads made Brother-specific (closes #347) 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. --- airscan-escl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/airscan-escl.c b/airscan-escl.c index 518e79b..a489095 100644 --- a/airscan-escl.c +++ b/airscan-escl.c @@ -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 @@ -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); @@ -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); @@ -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;