kopia lustrzana https://gitlab.com/sane-project/backends
add sanei_usb_reset function
rodzic
89de65c6cd
commit
a717c4658a
|
@ -278,6 +278,12 @@ extern SANE_Status sanei_usb_clear_halt (SANE_Int dn);
|
||||||
*/
|
*/
|
||||||
#define HAVE_SANEI_USB_CLEAR_HALT
|
#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.
|
/** Initiate a bulk transfer read.
|
||||||
*
|
*
|
||||||
* Read up to size bytes from the device to buffer. After the read, size
|
* Read up to size bytes from the device to buffer. After the read, size
|
||||||
|
|
|
@ -2014,6 +2014,34 @@ sanei_usb_clear_halt (SANE_Int dn)
|
||||||
return SANE_STATUS_GOOD;
|
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
|
SANE_Status
|
||||||
sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
sanei_usb_read_bulk (SANE_Int dn, SANE_Byte * buffer, size_t * size)
|
||||||
{
|
{
|
||||||
|
|
Ładowanie…
Reference in New Issue