add sanei_usb_reset function

merge-requests/1/head
Stphane Voltz 2010-05-16 07:37:34 +02:00
rodzic 89de65c6cd
commit a717c4658a
2 zmienionych plików z 34 dodań i 0 usunięć

Wyświetl plik

@ -278,6 +278,12 @@ extern SANE_Status sanei_usb_clear_halt (SANE_Int dn);
*/
#define HAVE_SANEI_USB_CLEAR_HALT
/** Reset device
*
* @param dn device number
*/
extern SANE_Status sanei_usb_reset (SANE_Int dn);
/** Initiate a bulk transfer read.
*
* Read up to size bytes from the device to buffer. After the read, size

Wyświetl plik

@ -2014,6 +2014,34 @@ sanei_usb_clear_halt (SANE_Int dn)
return SANE_STATUS_GOOD;
}
SANE_Status
sanei_usb_reset (SANE_Int dn)
{
#ifdef HAVE_LIBUSB
int ret;
ret = usb_reset (devices[dn].libusb_handle);
if (ret){
DBG (1, "sanei_usb_reset: ret=%d\n", ret);
return SANE_STATUS_INVAL;
}
#elif defined(HAVE_LIBUSB_1_0)
int ret;
ret = libusb_reset_device (devices[dn].lu_handle);
if (ret){
DBG (1, "sanei_usb_reset: ret=%d\n", ret);
return SANE_STATUS_INVAL;
}
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
DBG (1, "sanei_usb_reset: libusb support missing\n");
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
return SANE_STATUS_GOOD;
}
SANE_Status
sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
{