[sane-devel] sanei_usb and libusb_timeout

René Rebe rene@exactcode.de
Thu, 02 Dec 2004 01:53:11 +0100


Henning Meier-Geinitz wrote:

> On Wed, Dec 01, 2004 at 02:54:59PM +0100, René Rebe wrote:
>>the default timeout passed to libusb of 30 seconds is quite a bit long. 
>>So recovering from errors is already quite annoying for some use cases. 
>>Now I have a situation where I expect an error to happen for some models 
>>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 attached 
>>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 = 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");
> #endif
> }
> That's completey untested.

I would even add the sanei_usb_get_timeout along the way and would 
commit it when it is used in my backend and tested to work.

I agree that it has advantages to keep this connection dependent and add 
seperate iee1394 and SCSI functions later, when they are needed (e.g. 
not unify them into one function).

Have fun,

René Rebe - Rubensstr. 64 - 12157 Berlin (Europe / Germany)
             http://www.exactcode.de | http://www.exactcode.de/t2
             +49 (0)30  255 897 45