From 9a8797876c66fc0936d7b5e122e6fcd9b0c36bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Voltz?= Date: Thu, 22 Oct 2009 06:25:03 +0200 Subject: [PATCH] fix compatible cache test for gl646 cis scanners --- backend/genesys_gl646.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/backend/genesys_gl646.c b/backend/genesys_gl646.c index a18340a55..ee7db78c6 100644 --- a/backend/genesys_gl646.c +++ b/backend/genesys_gl646.c @@ -4884,6 +4884,7 @@ gl646_is_compatible_calibration (Genesys_Device * dev, #ifdef HAVE_SYS_TIME_H struct timeval time; #endif + int compatible = 1; DBG (DBG_proc, "gl646_is_compatible_calibration: start (for_overwrite=%d)\n", @@ -4905,15 +4906,27 @@ gl646_is_compatible_calibration (Genesys_Device * dev, } dev->current_setup.xres = dev->settings.xres; + DBG (DBG_io, + "gl646_is_compatible_calibration: requested=(%d,%f), tested=(%d,%f)\n", + dev->current_setup.channels, dev->current_setup.xres, + cache->used_setup.channels, cache->used_setup.xres); + /* a calibration cache is compatible if color mode and x dpi match the user - * requested scan */ - if ((dev->current_setup.channels != cache->used_setup.channels) - || (dev->current_setup.xres != cache->used_setup.xres)) + * requested scan. In the case of CIS scanners, dpi isn't a criteria */ + if (dev->model->is_cis == SANE_FALSE) + { + compatible = + ((dev->current_setup.channels == cache->used_setup.channels) + && (((int) dev->current_setup.xres) == + ((int) cache->used_setup.xres))); + } + else + { + compatible = + (dev->current_setup.channels == cache->used_setup.channels); + } + if (!compatible) { - DBG (DBG_io, - "gl646_is_compatible_calibration: requested=(%d,%f), tested=(%d,%f)\n", - dev->current_setup.channels, dev->current_setup.xres, - cache->used_setup.channels, cache->used_setup.xres); DBG (DBG_proc, "gl646_is_compatible_calibration: completed, non compatible cache\n"); return SANE_STATUS_UNSUPPORTED;