aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Platt <dplatt@radagast.org>2016-12-15 23:02:42 -0800
committerDave Platt <dplatt@radagast.org>2016-12-15 23:02:42 -0800
commit28963459a4ac43100b8e377d65332d81a2660c0d (patch)
treeed2b7c52eb8793feeb33f0dfd1e7b214810c814e
parent6585b6f60d07a196e42c99b935e2754bbc80b3c8 (diff)
avision.c: Recognize "backlight on" status
Avision scanners can return an additional light-status value meaning "Transparent Media Adapter back-light is on". Accept this as equivalent to "on" during the lamp-warmup check prior to starting a scan. Re-check the light status after sending the window command, as the light selection might have been changed and a further warm-up may be required.
-rw-r--r--backend/avision.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/backend/avision.c b/backend/avision.c
index 042f51c..945092e 100644
--- a/backend/avision.c
+++ b/backend/avision.c
@@ -2739,7 +2739,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;
@@ -2765,10 +2765,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) {
@@ -8372,6 +8372,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