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

Alexey Osipov simba at lerlan.ru
Wed Jun 8 11:36:06 UTC 2011


В Втр, 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:

reg  | Snoop | genesys | comment
-----+-------+---------+------------------------
0x1e | 0x41  | 0x80    | high word is for watchdog; low word is for setting CCD dummy lines; changing value to 0x41 didn't help with issue 1
     |       |         |
0x22 | 0x20  | 0xc0    | number of fwd/bwd steps; not relevant for issue 1
0x23 | 0x20  | 0xc0    | ---//---
     |       |         |
0x30 | 0x01  | 0x00    | start pixel; related to geometry; irrelevant to issue 1
0x31 | 0x2a  | 0xb5    | ---//---
     |       |         |
0x32 | 0x29  | 0x28    | end pixel; related to geometry; irrelevant to issue 1
0x33 | 0x02  | 0x8c    | ---//---
     |       |         |
0x34 | 0x0e  | 0x0f    | dummy pixel count; I've tried to set this to 0x0e but it isn't help
     |       |         |
0x36 | 0x77  | 0x77    | max word size per line; This value is calculated from geometry, so I think is irrelevant to issue 1
0x37 | 0x88  | 0x85    | ---//---
     |       |         |
0x3d | 0x00  | 0x00    | motor feeding steps; don't think is related to issue 1
0x3e | 0x01  | 0x00    | ---//---
0x3f | 0x51  | 0xdb    | ---//---
     |       |         |
0x60 | 0x54  | 0x02    | related to motor slope tables, so i think unrelated to issue 1
0x61 | 0xd4  | 0x49    | ---//---
0x62 | 0x04  | 0x00    | ---//---
0x63 | 0x2c  | 0x0c    | ---//---
     |       |         |
0x66 | 0x10  | 0x30    | GPO12~7 output ports. This maybe interesting. 
0x68 | n/a   | 0x31    | GPO12~7 enable mask.
     |       |         |
     |       |         | If I set 0x66 = 0x10 and 0x68 = 0x31 or 0x30, the image become very dark with wrong gamma.
     |       |         | 
     |       |         | If I set 0x66 = 0x10 and 0x68 = 0x10, I got the same interlaced image as
     |       |         | described in issue 1 with no change.
     |       |         |
     |       |         | If I set 0x66 = 0x10 and 0x68 = 0x11, I got only left half of the image, while right
     |       |         | half of the image is entirely black. Left half is still interlaced.

I need an advice what to try next.

Regards,
Alexey.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hp2400-1200dpi-progress.patch
Type: text/x-patch
Size: 2643 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110608/7bf2ddf2/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hp2400-geometry-fix.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20110608/7bf2ddf2/attachment-0001.bin>


More information about the sane-devel mailing list