[sane-devel] Re: genesys and hp2400

stef svoltz@wanadoo.fr
Tue, 22 Mar 2005 07:57:05 +0100


	I've started to add values for hp2400 in genesys_devices.c, 
accordingly to some usbsniff logs I received. I have also added a
genesys_repark_head() function that do the same thing than the windows
driver: it moves head forward slightly, then go backward for a long distance,
which eventually parks head.
	Since I haven't the hardware, it is untested. To fix it, you'll have 
to get the registers match the following values (start and end pixel aren't
important since no data is actually scanned):

slope_table0=800 800
R01=0x00	CCD, disable shading, normal scanning, uncompressed data, DRAM 4Mx1, shading whole line, disable scan
R02=0x31	auto-go-home enabled, enable moving when buffer full, auto-go-home after scan, turn on MOTOR power and phase, one table motor moving, motor forward, bipolar: half step, unipolar: half step
R03=0x19	alternated CCD TG function disabled, select dpi deletion function, transparency lamp off, lamp POWER on, lamp sleeping on, lamp on time=1*64k line period
R04=0x13	color lineart, 8 bits data, frontend type 16 bits, scan color type color, frontend B 
R05=0x50	1200 dpi, 14 bits gamma table, disable gamma correction, normal gray CIS, 24 clocks/pixel
R06=0x18	PWRBIT on, shading gain=4, normal AFE image capture
R07=0x00	MPU access under command mode, MPU write DRAM under command mode, 
R08=0x02	CCD RS rising edge position=2
R09=0x16	CCD RS falling edge position=22
R0a=0x0b	CCD CP rising edge position=11
R0b=0x15	CCD CP falling edge position=21
R11=0x00	Red exposure time=0
R13=0x00	Green exposure time=0
R15=0x00	Blue exposure time=0
R16=0x33	CCD CP & RS low when TG high, forward CCD RGBSEL, inverse CCD TG, inverse CCD Clock 1, forward CCD Clock 2, forward CCD CP & RS, disable CCD TG position Clock 1/2 signal, disable CCD TG position CP & RS signal
R17=0x08	without dummy line CCD TG type, CCD TG width=8
R18=0x30	TG and clock set to non-Canon CIS style, 2 time CCD clocks speed for dummy line, half cycle per pixel for CCD Clock/2, sytem clock for CCD Clock/2 delay=0, 1 time CCD Clock speed for capture image
R19=0x2a	dummy exposure time=42
R1a=0x00	CCD Clock rising edge position=0
R1b=0x00	CCD Clock falling edge position=0
R1c=0x00	disable CCD Clock 3, forward CCD Clock 3, Blue channel TG=0, Green channel TG=0, Red channel TG=0
R1d=0x02	automatic CCD Clock/2 programming, CCD shoulder width=2
R1e=0x10	watchdog time=1, 0 dummy line
R1f=0x10	SCANFED=16
R20=0x20	BUFSEL=32 2k words
R21=0x02	STEPNO=2
R22=0x10	FWDSTEP=16
R23=0x10	BWDSTEP=16
R24=0x02	FASTNO=2
R27=0xd4	LINCNT=212
R29=0xff	LAMPPWM=511 12 duty
R2d=0x58	DPISET=600 
R2e=0x78	B&W high threshold=120
R2f=0x7f	B&W low threshold=127
R31=0x57	start pixel=87 
R33=0xb7	end pixel=2487 
R34=0x0c	dummy pixel count=12
R37=0x11	maximum word size per line=3601 
R39=0x7e	CCD line period set to 11902 
R3f=0xe8	motor feeding steps write=232 
R50=0x00	frontend read address=0
R51=0x00	frontend write address=0
R52=0x0b	Red low byte AFE data latch=11
R53=0x0f	Red high byte AFE data latch=15
R54=0x13	Green low byte AFE data latch=19
R55=0x17	Green high byte AFE data latch=23
R56=0x03	Blue low byte AFE data latch=3
R57=0x07	Blue high byte AFE data latch=7
R58=0x63	AFE image sampling rising edge=12, AFE image sampling pulse width=3, 
R59=0x00	AFE dark voltage sampling rising edge=0, AFE dark voltage sampling pulse width=0, 
R5a=0xc1	Wolfson AFE type, select reset level clamp, AFE CDSREF=0, AFE RLC=1, 5a inconnu
R5c=0x00	first point of falling edge=0, 
R5d=0x00	second point of falling edge=0, 
R5e=0x00	first point of falling edge=0, 
R5f=0x00	second point of falling edge=0, 
R63=0x00	Z2MOD=0
R64=0x00	unipolar motor phase=0
R65=0x3f	unipolar motor phase duty cycle=63/64
R67=0x00	GPO=1000
R69=0x00	GPO enable=3100
R6a=0x7f	bipolar: half step, unipolar: half stepunipolar motor phase duty cycle=63/64
R6b=0x80	fast moving slop steps=128
R6c=0x00	TGTIME=0^2 periods, Z1MOD[18:16]=0, Z2MOD[18:16]=0, 
R6d=0x7f	go home deceleration steps=3^2, stop time (in LPERIOD)=31, 

	You'll have to set SANE_DEBUG_GENESYS to 255 to get log from the
backend. When genesys_repark_head() is finished, the backend will try to do
genesys_warmup_lamp() . However, I haven't touch it for hp2400 yet. From
windows logs, we can see that 2 lines are read at a time, while current code
reads only one. It seems that this warm up also does offset and coarse gain

	More usbsniff logs are needed to complete hp2400 support. The log of
a fresh (first) plug of the scanner followed by a preview would be interested.
Then full width scans (but with height kept low to minimize data) at 150, 300,
600 and 1200 dpi will allow us to find how the hp2400 CCD works.
	When using usbsniff, I launch it before plugging the scanner. Then each
time a scan is done, I click on the usbsniff window to give it focus. In the
windows world, that gives a high priority, and ensures that it can log all USB 
packets correctly.