[sane-devel] [PATCH] Progress on HP2400 (genesys backend)

Alexey Osipov simba at lerlan.ru
Thu Jun 9 08:49:37 UTC 2011


В Срд, 08/06/2011 в 18:36 +0700, Alexey Osipov пишет:
> В Втр, 07/06/2011 в 22:20 +0200, stef пишет: 
> > Le mardi 7 juin 2011 21:07:08 Alexey Osipov, vous avez écrit :
> > > Hi, dear SANE developers!
> > > 
> > > Proposed patch enable support of 50/150/600dpi Color/Gray/LineArt modes
> > > for Hewlett-Packard ScanJet 2400 scanner.
> > > 
> > > This was made by parsing UsbSnoop logs with stef's scripts (thank you!).
> > > 
> > > 100/300dpi modes were already good, so I didn't touch them.
> > > 
> > > I have also refined sensor and motor values for 1200dpi modes, but there
> > > are some problems with them.
> > > 
> > > Here is a list of remaining problems I can't solve:
> > > 
> > > 1. 1200dpi Gray mode works, but the resulting image is interlaced
> > > vertically with black one-pixel width lines. Why this can happen?
> > > Example: http://lion-simba.github.com/1200dpi_gray_lines.tiff
> > > 
> > > 2. 1200dpi Color mode works, but very slow. Scanner warm-up and
> > > calibration takes approx 5 mins before head even moves. Then, when
> > > scanning begins, head moves forward and backward each few lines. I have
> > > made timestamped logs of this situation (truncated log attached). You can
> > > see - problem is in "gl646_bulk_read_data" which regularly hangs for
> > > approx 10 seconds like this:
> > > 
> > > during warm-up and calibration:
> > > ---------------------
> > > 1307470777: [genesys_gl646] gl646_bulk_read_data: trying to read 65472
> > > bytes of data 1307470778: [genesys_gl646] gl646_bulk_read_data read 65472
> > > bytes, 679896 remaining 1307470778: [genesys_gl646] gl646_bulk_read_data:
> > > trying to read 65472 bytes of data 1307470778: [genesys_gl646]
> > > gl646_bulk_read_data read 65472 bytes, 614424 remaining 1307470778:
> > > [genesys_gl646] gl646_bulk_read_data: trying to read 65472 bytes of data
> > > [9 seconds delay]
> > > 1307470787: [genesys_gl646] gl646_bulk_read_data read 65472 bytes, 548952
> > > remaining 1307470787: [genesys_gl646] gl646_bulk_read_data: trying to read
> > > 65472 bytes of data 1307470787: [genesys_gl646] gl646_bulk_read_data read
> > > 65472 bytes, 483480 remaining ---------------------
> > > 
> > > during scan:
> > > ---------------------
> > > 1307471061: [genesys_gl646] gl646_bulk_read_data: requesting 30464 bytes
> > > 1307471061: [genesys_gl646] gl646_bulk_read_data: trying to read 30464
> > > bytes of data [9 seconds delay]
> > > 1307471070: [genesys_gl646] gl646_bulk_read_data read 30464 bytes, 0
> > > remaining 1307471070: [genesys_gl646] gl646_bulk_read_data: end
> > > ---------------------
> > > 
> > > Any ideas of what is wrong? Proprietary driver running on the same
> > > system scan well in 1200dpi Color, so I think this is not libusb bug.
> > > Maybe some GL646 miscofiguration?
> > > 
> > > 3. In all modes, there are extra pixels to the left of the image, which
> > > are beyond of glass window of scanner. Meanwhile, right side of image is
> > > cropped by (i guess) same number of pixels. I think it can be fixed by
> > > tuning CCD_start_xoffset/dummy_pixel/sensor_pixels in Genesys_Sensor,
> > > but I'm unsure what is for exactly? What is dummy_pixel?
> > > 
> > > Regards,
> > > Alexey.
> > 
> > 	Hello,
> > 
> > 	good job, if I understand well, 50, 100, 150, 300 and 600 dpi modes are 
> > correct. That's great.
> 
> Yes, this is correct.
> 
> > 	The 1 & 2 issues are surely related. Some registers maybe incorrectly 
> > set. What you can do is to compare all the register set at scan time with the 
> > one from USB log at 1200 dpi. If you look at the code there some places in 
> > genesys_gl646.c where some actions are taken depending of the CCD. Maybe a 
> > case for the HP2400 CCD should be added.
> 
> Ok, I have made some more research and found out several different
> registers.
> 
> After setting register 0x1e from 0x80 to 0x81 (set 1 CCD dummy line
> according to GL646 datasheet) the issue 2 has gone (patch attached).
> 
> I have also refine geometry values of Genesys_Model hp2400c_model in
> genesys_devices.c as you suggested, so the issue 3 also gone (patch
> attached).
> 
> However, issue 1 is still there (for Color, Gray and LineArt modes).
> There are several registers with different values in UsbSnoop logs and
> genesys logs:

> I need an advice what to try next.

Ok, I need not any advices. :)

Happy to say that I got working 1200dpi mode now. :)

The problem was in wrong value in frontend register number 3. The value
0x02 is good for 50-600 dpi, but gives interlaced result for 1200 dpi.
In UsbSnoop logs there is a value 0x32 for this register, but I found
out that scanner works good with value 0x12 (just like HP3670 in 1200
dpi mode). So I left the value 0x12 for both scanners.

GPO12 output port also need to be manipulated: in 1200dpi it must be set
to zero, while in other modes it must be one.

So, I had to add some workaround code in genesys_gl646.c. Results in
genesys-hp2400-1200dpi-done.patch.

After solving this I notice another bug: if start scanning position (y)
is not zero, the head moves double length way and eventually goes beyond
bottom border. I fix this by changing optical_yres of MOTOR_HP2400 from
2400 to 1200. For fine tuning I create a new case in
gl646_setup_registers() for MOTOR_HP2400. Values seems good, except,
head positioning after calibration (shading) slightly different from the
case when no calibration was done. Also I had to change y_offset in
"Genesys_Model hp2400c_model" from 7.5 to 2.5.

Results in genesys-hp2400-fix-head-positioning.patch.


That way I have fully functional HP2400 scanner with genesys backend.
All modes works fine: 50, 100, 150, 300, 600, 1200 dpi; Color, Gray,
LineArt; 8, 16 bits per channel.
Head positioning works well. XSane works well.


Cumulative changes I made against current git master of sane-backends is
in genesys-hp2400-complete.patch.


Regards,
Happy Alexey. :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: genesys-hp2400-1200dpi-done.patch
Type: text/x-patch
Size: 2019 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110609/9ec52ee9/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genesys-hp2400-fix-head-positioning.patch
Type: text/x-patch
Size: 1418 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110609/9ec52ee9/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genesys-hp2400-complete.patch
Type: text/x-patch
Size: 8487 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110609/9ec52ee9/attachment-0005.bin>


More information about the sane-devel mailing list