[sane-devel] scanning problem for HP 2400

Pierre Willenbrock pierre at pirsoft.dnsalias.org
Fri Dec 30 14:13:55 UTC 2005


Parag N(पराग़) schrieb:
> Hello Pierre,
> On 12/29/05, Pierre Willenbrock <pierre at pirsoft.dnsalias.org> wrote:
> 
>>Hello Parag,
>>
[...]
>>
>>
>>--- genesys_gl646.c     2005-12-29 15:32:52.078821000 +0100
>>+++ genesys_gl646.c.patched     2005-12-29 15:30:29.209892250 +0100
>>@@ -1772,6 +1772,17 @@
>>       return status;
>>     }
>>
>>+  /* sends slope table 0 (move before scan area) */
>>+  status = gl646_send_slope_table (dev, 0, dev->slope_table1,
>>+                                  reg[reg_0x6b].value);
>>+  if (status != SANE_STATUS_GOOD)
>>+    {
>>+      DBG (DBG_error,
>>+          "gl646_park_head: failed to send slope table 1: %s\n",
>>+          sane_strstatus (status));
>>+      return status;
>>+    }
>>+
>>   /* sends slope table 1 (move before scan area) */
>>   status = gl646_send_slope_table (dev, 1, dev->slope_table1,
>>                                   reg[reg_0x6b].value);
>>

Revert that patch, it is obviously not helping. Looking at the
description for hp 2300c, i see it does not use park_head. Please remove
GENESYS_FLAG_USE_PARK from the flags.

>>--- genesys.c   2005-12-28 14:45:00.751717000 +0100
>>+++ genesys.c.patched   2005-12-29 15:41:08.445842000 +0100
>>@@ -914,7 +914,8 @@
>>                                        same_speed, yres);
>>
>>   if (dev->model->motor_type == MOTOR_5345
>>-      || dev->model->motor_type == MOTOR_HP2300)
>>+      || dev->model->motor_type == MOTOR_HP2300
>>+      || dev->model->motor_type == MOTOR_HP2400)
>>     return genesys_create_slope_table2 (dev, slope_table, steps,
>>                                        step_type, exposure_time,
>>                                        same_speed, yres);
>>
>>
> 
> 
>  I did what you said but still i am getting no. of lines to scan as
> 3510 whereas what i found exactly 1755 lines scanning head stops at
> other end.

The scan head is still moving too fast. Please check if there is a slope
table that ends on 2750 for full steps or 1375 for half steps. The slope
table generation code advertises that setting. step_type = 0 means full
steps, step_type = 1 means half steps. It is also encoded in register 2,
lowest 2 bits.

> I have some questions
> 1) in genesys_read_ordered_data function theres debug messages
>  DBG (DBG_info, "genesys_read_ordered_data: %d lines left by output\n",
>        ((dev->total_bytes_to_read - dev->total_bytes_read)*8)/
>           ((dev->settings.pixels)*channels*depth));
>   DBG (DBG_info, "genesys_read_ordered_data: %d lines left by input\n",
>        ((dev->read_bytes_left+dev->read_buffer.avail)*8)/
>        (src_pixels*channels*depth));
> 
> I want to know what is this formula to calulate lines
> scanned/remainging to scan?
> also what is making each call to genesys_read_ordered_datato print
> lines left with difference of 13 lines but not line by line.

genesys_read_ordered_data always processes multiple lines. The actual
number of lines depends on how much buffering capacity we provide and
the size of the buffer we got from the frontend.

To calculate the number of lines from a number of bytes we use the
number of pixels per line, the image depth and number of channels:

lines=(bytes*8)/(pixels*channels*depth)

pixels, channels and depth must be correct for the data counted by bytes.

So, for input we use the data we are still expecting from the scanner,
the data in our read buffer and the source pixel count. From this we can
calculate how many lines we still need to process.

For output we calculate how many bytes are left to output to the
frontend, and then use the pixel count requested by frontend.

> 2) want to know what must be no. lines for my HP 2400 to scan 3510 or
> 1750 or anyother?

The correct number probably is 3510. You are scanning at 300dpi, your
scan area is about 11.7" in height, so 11.7"*300dpi=3510.

> 3) i have taken log for 3510 lines where from 1755 lines onward
> scanner head still want to move forward from other end and made a
> noise but i let it upto lines finishes.
> my linux log for last few lines
[more log]
> [genesys] sanei_genesys_read_register (0x41, 0xc5) completed
> [genesys] sanei_genesys_read_register (0x41, 0xc5) completed
> [genesys] sanei_genesys_read_register (0x41, 0xc5) completed
> [genesys] sanei_genesys_read_register (0x41, 0xc5) completed
> [genesys] sanei_genesys_read_register (0x41, 0xc5): failed while
> setting register: Invalid argument
> [genesys_gl646] gl646_park_head: failed to read home sensor: Invalid argument
> [genesys] sane_cancel: failed to move scanhead to home position:
> Invalid argument
> [genesys] sane_close: start
> [genesys] sane_close: exit
> [genesys] sane_exit: start
> [genesys] sane_exit: exit
> 
Looks like gl646_park_head is really broken. Remove
GENESYS_FLAG_USE_PARK from the flags, this will make the backend use a
different function.

Regards,
  Pierre



More information about the sane-devel mailing list