[sane-devel] [genesy backend] some patches and a few questions

Stéphane VOLTZ svoltz@wanadoo.fr
Wed, 15 Dec 2004 07:50:44 +0100


  I have worked on the genesys experimental backend to make my MD6471 work. 
First here are some patches:
- I had to put back a MD6471 sensor since there is a little difference with 
the ST24:

- since the motors from the different scanners are different, I added a 
motor_type field in the device structure. I haven't created a Genesys_Motor 
struct since I haven't a clear idea of what it should really contain.

- I have removed the parameter override in genesys_create_slope_table, and 
changed a little the pow() computing, since my compiler produces buggy code
when 'j' is 0.

 Then comes some problems:
- I believe that there's a bug in genesys_create_slope_table. We cuurently 
     time_period =  /* time required for full steps */
 (u_int32_t) (yres * exposure_time / dev->model->base_ydpi)  /
       (start_speed + (1 - start_speed) * t);    

and I think it should be (multiply instead of a divide):
   time_period =  /* time required for full steps */
 (u_int32_t) (yres * exposure_time / dev->model->base_ydpi) *
      * (start_speed + (1 - start_speed) * t);

 With the first formula (divided by (start_speed + ....), I cannot reach
satsifying parameters to have a good slope_table, while with the second
formula (multyply by ...), I can find near perfect match with the slope tables
in the USB logs. However, changing it would mean changing the start_speed
and 'acceleration'. I can do it for the MD6471, but not fot the other 

- the MD6471 doesn't need the extensive asic test done at init, and I feel 
like adding a flag to optionally skip it.

- another problem is the warmup function, I think this isn't warmup, but
offset calibration. In th MD6471 logs, a one line scan is done with AFE offset 
at zero, then at a higher value, but both with a coarse gain at zero. And 
since this takes place where it should (right before coarse gain 
calibration), I really believe it is offset calibration. Lamp warmup 
detection is only a byproduct.

- I have created for my needs a genesys_par_head() which is used instead of 
slow_back_home() which doesn't work for my scanner. In fact, it is really 
close to genesys_check_scanner_lock(). It sends the head back home by setting 
motor to reverse direction, 2 table scanning and steps before scan area to 
65535. If parking head after moving it doesn't work, this will indeed detect 
if the head is locked, but doesn't seem the real goal of the function.

- and last, I resurrected genesys_search_start_position(), but taylored for 
the MD6471, would it be OK to add it, with a device flag to control if the 
backend calls it ? I need this to locate the black and with stripes below the 
scanner's top in order to make offset and coarse gain calibration work 

To sum up is it OK to:
- change genesy_create_slope_table()
- add a flag for optional lazy init
- add a genesys_park_head() and a flag to control it's use
- add a flag to control the use of genesys_search_start_position(), and
resurrect this function.
- either modify warmup(), or create a genesys_offset_calibration with it's 
assorted flag