[sane-devel] sanei_usb and libusb_timeout

Oliver Rauch Oliver.Rauch@Rauch-Domain.DE
01 Dec 2004 21:53:45 +0100


Am Mit, 2004-12-01 um 20.39 schrieb m. allan noah:
> On Wed, 1 Dec 2004, Henning Meier-Geinitz wrote:
>=20
> > Hi,
> >
> > On Wed, Dec 01, 2004 at 02:54:59PM +0100, Ren=C3=A9 Rebe wrote:
> >> the default timeout passed to libusb of 30 seconds is quite a bit lo=
ng.
> >> So recovering from errors is already quite annoying for some use cas=
es.
> >> Now I have a situation where I expect an error to happen for some mo=
dels
> >> and adjust the code-path of future commands due to this. An initial
> >> timeout for the error that might happen for 50% of the scanners atta=
ched
> >> is quite long ....
> >>
> >> So I propose the hand libusb_timeout into the hands of the backend
> >> author. Does anyone see problems with this? (except of [tiny] API
> >> changes :-()
> >
> > That's a good idea.
> >
> > Maybe something like this:
> >
> > SANE_Status
> > sanei_usb_set_timeout (SANE_Int msecs)
> > {
> > #ifdef HAVE_LIBUSB
> >  libusb_timeout =3D msecs;
> >  DBG (5, "sanei_usb_set_timeout:  set timeout to %d msecs\n", msecs);
> >  return SANE_STATUS_GOOD;
> > #else
> >  DBG (3, "sanei_usb_set_timeout:  libusb support missing\n");
> >  return SANE_STATUS_UNSUPPORTED;
> > #endif
> > }
> >
> > That's completey untested.
> >
> > Bye,
> >  Henning
> >
> >
>=20
> is there any value to makeing this function call have a more generic na=
me,=20
> like sanei_set_timeout() which could perhaps be a noop in the scsi case=
=20
> for now? is variable timeout ever going to apply to scsi?
>=20
> allan

I suggest to keep it as USB function. Other bus systems may need
different timeout values so it is better to use different functions for
different connection types.

Oliver