Added support to set the USB timeout.

merge-requests/1/head
Rene Rebe 2005-07-15 09:02:02 +00:00
rodzic 38cc925c4b
commit e5193fdcae
3 zmienionych plików z 26 dodań i 3 usunięć

Wyświetl plik

@ -1,3 +1,9 @@
2005-07-15 Rene Rebe <rene@exactcode.de>
* include/sane/sanei_usb.h sanei/sanei_usb.c: Added support to set
the USB timeout.
2005-07-10 Henning Meier-Geinitz <henning@meier-geinitz.de>
* backend/gt68xx.c backend/gt68xx_devices.c

Wyświetl plik

@ -1,5 +1,5 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2003 Rene Rebe (sanei_read_int)
Copyright (C) 2003, 2005 Rene Rebe (sanei_read_int,sanei_set_timeout)
Copyright (C) 2001, 2002 Henning Meier-Geinitz
This file is part of the SANE package.
@ -229,6 +229,13 @@ extern SANE_Status sanei_usb_open (SANE_String_Const devname, SANE_Int * dn);
*/
extern void sanei_usb_close (SANE_Int dn);
/** Set the libusb timeout for bulk and interrupt reads.
*
* @param timeout the new timeout in ms
*/
#define HAVE_SANEI_USB_SET_TIMEOUT
extern void sanei_usb_set_timeout (SANE_Int timeout);
/** Initiate a bulk transfer read.
*
* Read up to size bytes from the device to buffer. After the read, size

Wyświetl plik

@ -1,5 +1,5 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2003 Rene Rebe (sanei_read_int)
Copyright (C) 2003 Rene Rebe (sanei_read_int,sanei_set_timeout)
Copyright (C) 2001 - 2003 Henning Meier-Geinitz
Copyright (C) 2001 Frank Zago (sanei_usb_control_msg)
This file is part of the SANE package.
@ -108,7 +108,7 @@ device_list_type;
static device_list_type devices[MAX_DEVICES];
#ifdef HAVE_LIBUSB
static int libusb_timeout = 30 * 1000; /* 30 seconds */
static int libusb_timeout = 30 * 1000; /* 5 seconds was 30 * 1000 */
#endif /* HAVE_LIBUSB */
#if defined (__linux__)
@ -913,6 +913,16 @@ sanei_usb_close (SANE_Int dn)
return;
}
void
sanei_usb_set_timeout (SANE_Int timeout)
{
#ifdef HAVE_LIBUSB
libusb_timeout = timeout;
#else
DBG (1, "sanei_usb_close: libusb support missing\n");
#endif /* HAVE_LIBUSB */
}
SANE_Status
sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
{