[sane-devel] Re: problem resetting register

Parag N(पराग़) panemade at gmail.com
Tue Jan 3 05:42:08 UTC 2006


Hi,
On 1/2/06, Parag N(पराग़) <panemade at gmail.com> wrote:
> Hello,
>         This is with reference to my previous mails for Hp 2400
> genesys backend development. what i am getting is that after 1755
> lines head moves other end and instead of moving back it tries to move
> furhter. genesys code calulates that head has to scan 3510 lines which
> must be actually 1755 lines. so i modified code so that to reset head
> to move back after 1755 lines scanned. but besides i am writing to
> 0x02 register 53 decimal value it scanning further after 1755 and
> after lines count drop to 0 head automatically resets to home by
> moving backwards. code is included in sane_read in genesys.c
> heres the whole modified function
>
> SANE_Status
> sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len,
>            SANE_Int * len)
> {
>   Genesys_Scanner *s = handle;
>   SANE_Status status;
>   size_t local_len;
> unsigned int channels,depth,lines;
>   if (!s)
>     {
>       DBG (DBG_error, "sane_read: handle is null!\n");
>       return SANE_STATUS_INVAL;
>     }
>
>   if (!buf)
>     {
>       DBG (DBG_error, "sane_read: buf is null!\n");
>       return SANE_STATUS_INVAL;
>     }
>
>   if (!len)
>     {
>       DBG (DBG_error, "sane_read: len is null!\n");
>       return SANE_STATUS_INVAL;
>     }
>
>   *len = 0;
>
>   if (!s->scanning)
>     {
>       DBG (DBG_warn, "sane_read: scan was cancelled, is over or has not been "
>            "initiated yet\n");
>       return SANE_STATUS_CANCELLED;
>     }
>
>   DBG (DBG_proc, "sane_read: start\n");
>   channels = s->dev->current_setup.channels;
>   depth = s->dev->current_setup.depth;
>   lines=(((s->dev->total_bytes_to_read - s->dev->total_bytes_read)*8)/
>           (s->dev->settings.pixels*channels*depth));
>
>   DBG (DBG_info, "genesys_sane_read: %d lines left by output\n",lines);
>  if(lines==(lines/2))
> {
>  status =sanei_genesys_write_register (s->dev, 0x02, 53);
>   if (status != SANE_STATUS_GOOD)
>     {
>       DBG (DBG_error,
>            "sanei_genesys_fe_write_data: Failed while bulk writing
> registers: %s\n",
>            sane_strstatus (status));
>     return status;
>     }
> }
>   local_len = max_len;
>   status = genesys_read_ordered_data (s->dev, buf, &local_len);
>
>   *len = local_len;
>   return status;
> }
>
> Can anybody point out where the things are going wrong?
> Thanks & regards,
> Parag.
>

Anybody knows answer to above question please?
regards,
Parag.


More information about the sane-devel mailing list