Hi,

epjitsu backend v26 contains a regression for ADF scanners:
It makes setting the width setting useless.

The three attached patches contain the minimal changes to revert this "mis-
feature".

Please apply them to sane-backends' master branch to make the life of epjitsu 
ADF scanner owners as easy as it was before v26.

If you prefer getting them from a git repository, you can find them at
  https://github.com/marschap/sane-backends/tree/epjitsu-regression-fixes

Thanks in advance
Peter

-- 
Peter Marschall
pe...@adpm.de
>From 0a9791173d291b8b41880a6d6724211aab6ff745 Mon Sep 17 00:00:00 2001
From: Peter Marschall <pe...@adpm.de>
Date: Sun, 21 Sep 2014 14:45:49 +0200
Subject: [PATCH 3/3] epjitsu: read page_width pixels from scanner

---
 backend/epjitsu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/backend/epjitsu.c b/backend/epjitsu.c
index 4fd4b2b..3175649 100644
--- a/backend/epjitsu.c
+++ b/backend/epjitsu.c
@@ -2131,7 +2131,7 @@ change_params(struct scanner *s)
       /* adf with specified paper size */
       s->front.height = SCANNER_UNIT_TO_PIX(s->page_height, s->front.y_res);
     }
-    s->front.width_pix = s->block_img.width_pix;
+    s->front.width_pix = SCANNER_UNIT_TO_PIX(s->page_width, s->resolution * img_heads);
     s->front.x_start_offset = (s->block_xfr.image->width_pix - s->front.width_pix)/2;
     switch (s->mode) {
       case MODE_COLOR:
-- 
2.1.4

>From 85642100e10b1da35706cce007b76f5073d9b1fa Mon Sep 17 00:00:00 2001
From: Peter Marschall <pe...@adpm.de>
Date: Sun, 21 Sep 2014 12:24:28 +0200
Subject: [PATCH 2/3] epjitsu: run change_params after changing page_width

---
 backend/epjitsu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/backend/epjitsu.c b/backend/epjitsu.c
index 5011314..4fd4b2b 100644
--- a/backend/epjitsu.c
+++ b/backend/epjitsu.c
@@ -1712,8 +1712,8 @@ sane_control_option (SANE_Handle handle, SANE_Int option,
               return SANE_STATUS_GOOD;
 
           s->page_width = FIXED_MM_TO_SCANNER_UNIT(val_c);
-          *info |= SANE_INFO_RELOAD_OPTIONS;
-          return SANE_STATUS_GOOD;
+          *info |= SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
+          return change_params(s);
 
         case OPT_PAGE_HEIGHT:
           if (s->page_height == FIXED_MM_TO_SCANNER_UNIT(val_c))
-- 
2.1.4

>From 7d1e6a3e039ae5ea965a7af7a875b15f92d5c383 Mon Sep 17 00:00:00 2001
From: Peter Marschall <pe...@adpm.de>
Date: Sun, 21 Sep 2014 11:26:23 +0200
Subject: [PATCH 1/3] epjitsu: do not hardcode user-changeable options in
 change_params()

In addition, add a sanity check for tl_y.
---
 backend/epjitsu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/backend/epjitsu.c b/backend/epjitsu.c
index 08e78b2..5011314 100644
--- a/backend/epjitsu.c
+++ b/backend/epjitsu.c
@@ -1970,11 +1970,6 @@ change_params(struct scanner *s)
     s->max_y = PIX_TO_SCANNER_UNIT( settings[i].max_y, settings[i].y_res );
     s->min_y = PIX_TO_SCANNER_UNIT( settings[i].min_y, settings[i].y_res );
 
-    /* wrong place for this?*/
-    s->page_width = s->max_x;
-    s->br_x = s->max_x;
-    s->br_y = s->max_y;
-
     /*current dpi*/
     s->setWindowCoarseCal = settings[i].sw_coarsecal;
     s->setWindowCoarseCalLen = SET_WINDOW_LEN;
@@ -2019,6 +2014,8 @@ change_params(struct scanner *s)
        s->page_height = s->min_y;
     if (s->tl_y + s->page_height > s->max_y)
        s->tl_y = s->max_y - s->adf_height_padding - s->page_height ;
+    if (s->tl_y < 0)
+       s->tl_y = 0;
 
     if (s->page_height > 0) {
         s->br_y = s->tl_y + s->page_height;
-- 
2.1.4

-- 
sane-devel mailing list: sane-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to sane-devel-requ...@lists.alioth.debian.org

Reply via email to