[sane-devel] hp5590: Scan aborts when using default page size

Rainer Keller mail at rainerkeller.de
Sat May 24 18:41:33 UTC 2014


Hi,

when doing a scan from ADF with default page size it will abort with an error:

> scanimage --mode=Color --resolution=300 --source=ADF --verbose >/tmp/foo.pnm   
> [hp5590] Top Y (0) + pixels Y (106680) exceedes max Y 4200
> scanimage: sane_start: Invalid argument

After some debugging I could solve this by changing the br_x and br_y default 
values from millimeters to inches. For me it seems it this is the expected 
unit for these. It would be nice if someone could confirm this.

Using the attached patch it works:

> scanimage --mode=Color --resolution=300 --source=ADF --verbose >/tmp/foo.pnm
> scanimage: scanning image of size 2550x4200 pixels at 24 bits/pixel
> scanimage: acquiring RGB frame
> scanimage: min/max graylevel value = 0/255
> scanimage: read 32130000 bytes in total

Regards,

Rainer


>From 392b0e48582338517888153a9ee4a213183c24de Mon Sep 17 00:00:00 2001
From: Rainer Keller <mail at rainerkeller.de>
Date: Sat, 24 May 2014 20:15:02 +0200
Subject: [PATCH] hp5590: br_x and br_y have to be in inches

---
 backend/hp5590.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/backend/hp5590.c b/backend/hp5590.c
index 8db3d5e..19c7471 100644
--- a/backend/hp5590.c
+++ b/backend/hp5590.c
@@ -859,14 +859,14 @@ sane_control_option (SANE_Handle handle, SANE_Int 
option,
 	      range_x.max = SANE_FIX(scanner->info->max_size_x * 25.4);
 	      range_y.max = SANE_FIX(ADF_MAX_Y_INCHES * 25.4);
 	      scanner->br_x = scanner->info->max_size_x;
-	      scanner->br_y = ADF_MAX_Y_INCHES * 25.4;
+	      scanner->br_y = ADF_MAX_Y_INCHES;
 	    }
 	  if (strcmp ((char *) value, (char *) 
SANE_VALUE_SCAN_SOURCE_ADF_DUPLEX) == 0)
 	    {
 	      scanner->source = SOURCE_ADF_DUPLEX;
 	      range_x.max = SANE_FIX(scanner->info->max_size_x * 25.4);
 	      range_y.max = SANE_FIX(ADF_MAX_Y_INCHES * 25.4 * 2);
-	      scanner->br_y = ADF_MAX_Y_INCHES * 25.4 * 2;
+	      scanner->br_y = ADF_MAX_Y_INCHES * 2;
 	      scanner->br_x = scanner->info->max_size_x;
 	    }
 	  if (strcmp ((char *) value, (char *) 
SANE_VALUE_SCAN_SOURCE_TMA_SLIDES) == 0)
@@ -874,16 +874,16 @@ sane_control_option (SANE_Handle handle, SANE_Int 
option,
 	      scanner->source = SOURCE_TMA_SLIDES;
 	      range_x.max = SANE_FIX(TMA_MAX_X_INCHES * 25.4);
 	      range_y.max = SANE_FIX(TMA_MAX_Y_INCHES * 25.4);
-	      scanner->br_x = TMA_MAX_X_INCHES * 25.4;
-	      scanner->br_y = TMA_MAX_Y_INCHES * 25.4;
+	      scanner->br_x = TMA_MAX_X_INCHES;
+	      scanner->br_y = TMA_MAX_Y_INCHES;
 	    }
 	  if (strcmp ((char *) value, (char *) 
SANE_VALUE_SCAN_SOURCE_TMA_NEGATIVES) == 0)
 	    {
 	      scanner->source = SOURCE_TMA_NEGATIVES;
 	      range_x.max = SANE_FIX(TMA_MAX_X_INCHES * 25.4);
 	      range_y.max = SANE_FIX(TMA_MAX_Y_INCHES * 25.4);
-	      scanner->br_x = TMA_MAX_X_INCHES * 25.4;
-	      scanner->br_y = TMA_MAX_Y_INCHES * 25.4;
+	      scanner->br_x = TMA_MAX_X_INCHES;
+	      scanner->br_y = TMA_MAX_Y_INCHES;
 	    }
 	  if (info)
 	    *info = SANE_INFO_RELOAD_PARAMS | SANE_INFO_RELOAD_OPTIONS;
-- 
1.8.5.5



More information about the sane-devel mailing list