Attached is a patch which should allow HP 82xx/83xx scanners with the flat lightbox lid (that is, without an Automatic Document Feeder) to be used with SANE. These scanners can return a somewhat inconsistent set of status information (a non-zero ADF model code, but with an "ADF not present" status). The Avision backend treats this situation as an error; it makes several attempts to reset the ADF, and then gives up and reports "operation not supported".
This patch adds support for a new "option skip-adf" line in the avision.conf file. If this option is present, the backend will skip the ADF retry loop, treat the ADF as not-present, and allow the flatbed scan mode to be used. If this option isn't used, this patch has no effect. I'd like to make this a "smarter" fix which wouldn't require a scanner-specific option. To do that (if it's possible) I'll need some additional information about the ADF configurations out there in the Avision world. So, if you have an Avision scanner (particularly an HP-branded one) I'd appreciate it if you could run the following test: - Run "SANE_DEBUG_AVISION=7 scanimage > /dev/null 2>scanner-log" to capture as much information as possible. - "grep get_accessories_info scanner-log" You could do this either on a stock SANE install, or after installing this patch - I don't think it'll matter. Email me the lines from the grep, your scanner model number (including the USB ID), and tell me whether you have a flat lid or an Automatic Document Feeder on the scanner (the ADF model information from its label would be useful). The patch may be applied to a freshly-checked-out copy of the sane-backends git tree via the usual method: cd into sane-backends and then "patch -p1 < avision-1.patch", configure, make, and install.
commit 0dadeaba0a7d55dfa558e2fa011ea9f003cfedfb Author: Dave Platt <[email protected]> Date: Mon Nov 21 22:12:43 2016 -0800 Add ADF override Add a configuration override which causes the Avision backend to trust the "ADF present" flag returned by the scanner. If this override is set, and if the scanner returns an "ADF present" flag of 0, the backend will ignore any non-zero "ADF model" byte and won't try to reset the ADF and retry the query. diff --git a/backend/avision.c b/backend/avision.c index 146125c..b02b547 100644 --- a/backend/avision.c +++ b/backend/avision.c @@ -1277,6 +1277,9 @@ static SANE_Bool force_calibration = SANE_FALSE; static SANE_Bool force_a4 = SANE_FALSE; static SANE_Bool force_a3 = SANE_FALSE; +/* trust ADF-presence flag, even if ADF model is nonzero */ +static SANE_Bool skip_adf = SANE_FALSE; + /* hardware resolutions to interpolate from */ static const int hw_res_list_c5[] = { @@ -3218,11 +3221,13 @@ get_accessories_info (Avision_Scanner* s) { dev->inquiry_duplex = 1; dev->inquiry_duplex_interlaced = 0; - } else if (result[0] == 0 && result[2] != 0) { + } else if (result[0] == 0 && result[2] != 0 && !skip_adf) { /* Sometimes the scanner will report that there is no ADF attached, yet * an ADF model number will still be reported. This happens on the * HP8200 series and possibly others. In this case we need to reset the - * the adf and try reading it again. + * the adf and try reading it again. Skip this if the configuration says + * to do so, so that we don't fail out the scanner as being broken and + * unsupported if there isn't actually an ADF present. */ DBG (3, "get_accessories_info: Found ADF model number but the ADF-present flag is not set. Trying to recover...\n"); status = adf_reset (s); @@ -7630,6 +7635,11 @@ sane_reload_devices (void) linenumber); force_a3 = SANE_TRUE; } + else if (strcmp (word, "skip-adf") == 0) { + DBG (3, "sane_reload_devices: config file line %d: enabling skip-adf\n", + linenumber); + skip_adf = SANE_TRUE; + } else if (strcmp (word, "static-red-calib") == 0) { DBG (3, "sane_reload_devices: config file line %d: static red calibration\n", linenumber); diff --git a/doc/sane-avision.man b/doc/sane-avision.man index 299bb72..6a991b6 100644 --- a/doc/sane-avision.man +++ b/doc/sane-avision.man @@ -36,6 +36,7 @@ a hash mark (#) are ignored. A sample configuration file is shown below: \ option force\-a4 option force\-a3 + option skip\-adf option disable\-gamma\-table option disable\-calibration \ @@ -61,6 +62,15 @@ known to return bogus data are marked in the backend so if you need this option please report this to the backend maintainer. USE WITH CARE! .TP +skip\-adf: +Forces the backend to ignore an inconsistent ADF +status returned by the scanner (ADF not present, but +ADF model number non-zero). Without this option, the +backend will make several attempts to reset the ADF +and retry the query in this situation, and will fail +with a "not supported" error if the ADF still doesn't +respond. +.TP disable\-gamma\-table: Disables the usage of the scanner's gamma-table. You might try this if your scans hang or only produces
-- sane-devel mailing list: [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel Unsubscribe: Send mail with subject "unsubscribe your_password" to [email protected]
