[sane-devel] HP ScanJet 5590 big endian

Nhan Ngo Dinh nngodinh at tiscali.it
Wed Jun 13 15:42:59 UTC 2012

Hi Ilia,

I'm using the scanner from Flatbed and ADF, using color and a resolution 
of 100dpi and 300dpi and it works without any problem. I've also patched 
the CVS version of scanbuttond (which has been mostly taken from your 
code) with the same 3 changes to achieve scanbuttond also to work with 
the 5 scanner buttons (see attached).

I've seen that 150dpi produces distorted images from ADF, but I've not 
performed a related test using Little Endian to see if it is a common 

On the other hand I've also tested ADF Duplex, but there is something to 
be corrected here: while the ADF input is continuously on moving paper, 
so your code breaks the page at the specified page height, the duplex 
unit works like this:

1) the first page is taken from ADF input and scanned
2) once the page is in ADF output, the page is taken back into the ADF 
and scanned on the other side
3) once finished, the page is taken back again into the ADF to recover 
its original side and placed into the ADF output with the correct face up

These operations are performed while the scanner sensor is turned off 
and back on when the paper flows into the ADF unit but has not to be 
acquired. Unfortunately, the timing of such on/off events is not set 
exactly so a very small (about 2cm) of blank acquisition is taken and 
shifts all the contents forward each 2 pages.

The result is:

1) the 1st and 2nd pages are acquired correctly
2) the 3rd page has a 2cm blank header on the top of it
3) the 4th page has a 2cm header wrapped by the bottom of the 3rd page
4) the 5th page has a 2cm header wrapped by the bottom of the 4th page + 
2cm blank header
... and so on

Before patching the driver, what do you think if we:

1) add a page counter in struct hp5590_scanner, to understand if even or odd
2) do some calibrated input skip (e.g. a dummy call to hp5590_read()) on 
hp5590.c:1249 when scanner->transferred_image_size == 0 and 
scanner->source == SOURCE_ADF_DUPLEX and the current page number is > 1 
and odd

Then another question:
Do you have any suggestion for getting the copy counter shown in the LCD 
display of the scanner? And the Color/Grayscale led switch?

Thank you very much.

On 05/24/2012 02:27 PM, Ilia Sotnikov wrote:
> On Tue, May 22, 2012 at 7:27 PM, Nhan Ngo Dinh<nngodinh at tiscali.it>  wrote:
> ...
>> Little Endian (working)
>> =======================
> ...
>> [sanei_usb] 0000: C0 04 00 12 00 00 32 00
>> Big Endian (not working)
> ...
>> [sanei_usb] 000 C0 04 00 12 00 00 00 32
> ...
>> Since the module does work in little endian, and the content of ctrl is
>> passed through, I assume that the hardware wants ctrl.wLength in little
>> endian, so I replaced it with:
>> ctrl.wLength = htole16 (size);
> ...
>> verify_cmd = le16toh (verify_cmd);
>> I've tested the scanner with such modification and it works, but I've not
>> tested it for regressions in little endian. The patch is attached.
> Nhan,
> thanks, nice catch. Does the backend work as expected (produces normal
> images, correctly uses selected source etc) after applying the patch?
> I suspect there are other places in the backend we should take a
> closer look.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: scanbuttond-hp5590-bigendian.patch
Type: text/x-patch
Size: 1283 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20120613/b4acf286/attachment.bin>

More information about the sane-devel mailing list