[sane-devel] Fix for infinte for loop

stef stef.dev at free.fr
Mon Jul 11 05:37:06 UTC 2011


Le samedi 9 juillet 2011 11:05:56 Hans Petter Selasky, vous avez écrit :
> On Saturday 09 July 2011 06:38:27 stef wrote:
> > Le vendredi 8 juillet 2011 11:09:15 Hans Petter Selasky, vous avez écrit :
> > > --- /sane-backends-1.0.21/backend/genesys_gl646.c.orig    2011-07-08
> > > 11:07:05.000000000 +0200 +++
> > > /sane-backends-1.0.21/backend/genesys_gl646.c 2011-07-08
> > > 11:07:47.000000000 +0200 @@ -3068,9 +3068,10 @@
> > > 
> > >    /* loop until head parked */
> > >    if (wait_until_home)
> > >    
> > >      {
> > > 
> > > -      int loop = 0;
> > > +      int loop;
> > > 
> > > -      while (loop < 3)         /* do not wait longer then 30 seconds
> > > */ +       /* do not wait longer then 30 seconds */
> > > +       for (loop = 0; loop < 300; loop++)
> > > 
> > >         {
> > >         
> > >           status = sanei_genesys_get_status (dev, &val);
> > >           if (status != SANE_STATUS_GOOD)
> > > 
> > > I'm not suscribed to this list. Please keep me CC'ed.
> > > 
> > > --HPS
> > 	
> > 	Hello,
> > 	
> > 	may I have more details ? On which hardware do you see this ? Why are
> > 	you
> > 
> > patching SANE 1.0.21 and not 1.0.22 ?
> 
> Hi,
> 
> It is not an real issue, but you see the code is broken. I saw this issue
> on a HP scanner which is now broken due to unknown reasons. I doesn't
> rewind the scanning head any more.
> 
> I'm patching sane 1.0.21 because that is what is currently available in
> FreeBSD. I assume that the code is the same in 1.0.22 unless someone fixed
> this issue.
> 
> Thanks,
> 
>   --HPS
	
	Hello,

	the comment and the code are misleading, it is an unclean leftover of a 
timeout I have crudely removed since it was more an annoyance than a cure.
	The code is looping until head is parked, if your hardware doesn't park, 
a timeout won't help. Could you run scanimage with :
export SANE_DEBUG_GENESYS=255
export SANE_DEBUG_GENESYS_LOW=255
export SANE_DEBUG_GENESYS_GL646=255
and send me the debug output so I can have an idea of the problem ?

	You should really consider using 1.0.22 since the genesys backend is 
regularly improved. By using an old release you are at risk of trying to fix 
an already fixed bug, or missing support for new scanner models.

Regards,
	Stef
	



More information about the sane-devel mailing list