This patch fixes a problem with Avision scanners when the "-source Transparency" option to scanimage is used to make scans of photographic negatives or slides.
Without this option, the "-source Transparency" option can be used once, but subsequent scans will probably hang and error out (the "wait for the light to warm up" loop doesn't understand the "backlight is on" status code). I'd appreciate testing of this patch, to make sure that the added wait_4_light() call doesn't cause problems on some scanners.
commit cab1021fc79fb4bc0603e1172d434d9ef58c3820 Author: Dave Platt <[email protected]> Date: Mon Nov 21 22:18:30 2016 -0800 Recognize "backlight on" status in Avision backend Avision scanners can return an additional light-status value meaning "transparency back-light is on". Accept this as equivalent to "on" when waiting to start a scan. Re-check the light status after sending the window command, as the light selection might have been changed. diff --git a/backend/avision.c b/backend/avision.c index 146125c..b4458ec 100644 --- a/backend/avision.c +++ b/backend/avision.c @@ -2736,7 +2736,7 @@ wait_4_light (Avision_Scanner* s) struct command_read rcmd; char* light_status[] = { "off", "on", "warming up", "needs warm up test", - "light check error", "RESERVED" }; + "light check error", "backlight on", "RESERVED" }; SANE_Status status; uint8_t result; @@ -2762,10 +2762,10 @@ wait_4_light (Avision_Scanner* s) return status; } - DBG (3, "wait_4_light: command is %d. Result is %s\n", - status, light_status[(result>4)?5:result]); + DBG (3, "wait_4_light: command is %d. Result is %d (%s)\n", + status, result, light_status[(result>5)?6:result]); - if (result == 1) { + if (result == 1 || result == 5) { return SANE_STATUS_GOOD; } else if (dev->hw->feature_type & AV_LIGHT_CHECK_BOGUS) { @@ -8365,6 +8365,14 @@ sane_start (SANE_Handle handle) sane_strstatus (status)); goto stop_scanner_and_return; } + /* Re-check the light, as setting the window may have changed + * which light is to be turned on. */ + if (s->prepared == SANE_FALSE && dev->inquiry_light_control) { + status = wait_4_light (s); + if (status != SANE_STATUS_GOOD) { + return status; + } + } } #ifdef DEBUG_TEST
-- 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]
