kopia lustrzana https://gitlab.com/sane-project/backends
make GL646 detection work again
- add GL646 detection - don't close USB handle before probing chip so we avoid opening it againmerge-requests/1/head
rodzic
2f4a54809d
commit
3af775de44
|
@ -3451,27 +3451,33 @@ check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool from_file)
|
||||||
* @param from_file SANE_True if data read from file
|
* @param from_file SANE_True if data read from file
|
||||||
* @return a string containing the name of the detected scanner chip
|
* @return a string containing the name of the detected scanner chip
|
||||||
*/
|
*/
|
||||||
char * check_usb_chip (struct libusb_device *dev, int verbosity, SANE_Bool from_file);
|
char * check_usb_chip (int verbosity,
|
||||||
|
struct libusb_device_descriptor desc,
|
||||||
|
libusb_device_handle *hdl,
|
||||||
|
struct libusb_config_descriptor *config0);
|
||||||
|
|
||||||
static int verbose = 0;
|
static int verbose = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
genesys_write_reg (libusb_device_handle * handle, unsigned char reg,
|
genesys_write_reg (libusb_device_handle *handle, unsigned char reg,
|
||||||
unsigned char val)
|
unsigned char val)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
unsigned char data[2];
|
||||||
|
|
||||||
result =
|
data[0]=reg;
|
||||||
libusb_control_transfer (handle, 0x00, 0x00, 0x83, 0x00, ®, 0x01, TIMEOUT);
|
data[1]=val;
|
||||||
|
|
||||||
|
result = libusb_control_transfer (handle,
|
||||||
|
0x40,
|
||||||
|
0x04,
|
||||||
|
0x83,
|
||||||
|
0x00,
|
||||||
|
data,
|
||||||
|
0x02,
|
||||||
|
TIMEOUT);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
result =
|
|
||||||
libusb_control_transfer (handle, 0x00, 0x00, 0x85, 0x00, &val, 0x01, TIMEOUT);
|
|
||||||
if (result < 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3481,19 +3487,169 @@ genesys_read_reg (libusb_device_handle * handle, unsigned char reg,
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result =
|
result = libusb_control_transfer (handle,
|
||||||
libusb_control_transfer (handle, 0x00, 0x00, 0x83, 0x00, ®, 0x01, TIMEOUT);
|
0x40,
|
||||||
|
0x0c,
|
||||||
|
0x83,
|
||||||
|
0x00,
|
||||||
|
®,
|
||||||
|
0x01,
|
||||||
|
TIMEOUT);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
result =
|
result = libusb_control_transfer (handle,
|
||||||
libusb_control_transfer (handle, 0x80, 0x00, 0x84, 0x00, val, 0x01, TIMEOUT);
|
0xc0,
|
||||||
|
0x0c,
|
||||||
|
0x84,
|
||||||
|
0x00,
|
||||||
|
val,
|
||||||
|
0x01,
|
||||||
|
TIMEOUT);
|
||||||
if (result < 0)
|
if (result < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief check for genesys GL646 chips
|
||||||
|
*
|
||||||
|
* @param dev libusb device
|
||||||
|
* @param hdl libusb opened handle
|
||||||
|
* @param config0 configuration 0 from get config _descriptor
|
||||||
|
* @return a string with ASIC name, or NULL if not recognized
|
||||||
|
*/
|
||||||
|
static char *
|
||||||
|
check_gl646 (libusb_device_handle *handle,
|
||||||
|
struct libusb_device_descriptor desc,
|
||||||
|
struct libusb_config_descriptor *config0)
|
||||||
|
{
|
||||||
|
unsigned char val;
|
||||||
|
int result;
|
||||||
|
|
||||||
|
if (desc.bcdUSB != 0x110)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (bcdUSB = 0x%x)\n",
|
||||||
|
desc.bcdUSB);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (desc.bDeviceSubClass != 0x00)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (bDeviceSubClass = 0x%x)\n",
|
||||||
|
desc.bDeviceSubClass);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (desc.bDeviceProtocol != 0)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (bDeviceProtocol = 0x%x)\n",
|
||||||
|
desc.bDeviceProtocol);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check endpoints */
|
||||||
|
if (config0->interface[0].altsetting[0].bNumEndpoints != 3)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (bNumEndpoints = %d)\n",
|
||||||
|
config0->interface[0].altsetting[0].bNumEndpoints);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config0->interface[0].altsetting[0].endpoint[0].
|
||||||
|
bEndpointAddress != 0x81)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[0].
|
||||||
|
bmAttributes != 0x02)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[0].
|
||||||
|
wMaxPacketSize != 0x40)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[0].bInterval !=
|
||||||
|
0x0))
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf
|
||||||
|
(" this is not a GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
|
||||||
|
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
|
||||||
|
config0->interface[0].altsetting[0].endpoint[0].
|
||||||
|
bEndpointAddress,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[0].bmAttributes,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[0].
|
||||||
|
wMaxPacketSize,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[0].bInterval);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config0->interface[0].altsetting[0].endpoint[1].
|
||||||
|
bEndpointAddress != 0x02)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[1].
|
||||||
|
bmAttributes != 0x02)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[1].
|
||||||
|
wMaxPacketSize != 0x40)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[1].bInterval !=
|
||||||
|
0))
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf
|
||||||
|
(" this is not a GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
|
||||||
|
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
|
||||||
|
config0->interface[0].altsetting[0].endpoint[1].
|
||||||
|
bEndpointAddress,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[1].bmAttributes,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[1].
|
||||||
|
wMaxPacketSize,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[1].bInterval);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config0->interface[0].altsetting[0].endpoint[2].
|
||||||
|
bEndpointAddress != 0x83)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[2].
|
||||||
|
bmAttributes != 0x03)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[2].
|
||||||
|
wMaxPacketSize != 0x1)
|
||||||
|
|| (config0->interface[0].altsetting[0].endpoint[2].bInterval !=
|
||||||
|
8))
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf
|
||||||
|
(" this is not a GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
|
||||||
|
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
|
||||||
|
config0->interface[0].altsetting[0].endpoint[2].
|
||||||
|
bEndpointAddress,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[2].bmAttributes,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[2].
|
||||||
|
wMaxPacketSize,
|
||||||
|
config0->interface[0].altsetting[0].endpoint[2].bInterval);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = genesys_write_reg (handle, 0x38, 0x15);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (writing register failed)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = genesys_read_reg (handle, 0x4e, &val);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (reading register failed)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val != 0x15)
|
||||||
|
{
|
||||||
|
if (verbose > 2)
|
||||||
|
printf (" this is not a GL646 (reg 0x4e != reg 0x38)\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "GL646";
|
||||||
|
}
|
||||||
|
|
||||||
/** @brief check for known genesys chip
|
/** @brief check for known genesys chip
|
||||||
*
|
*
|
||||||
* Try to check if the scanner use a known genesys ASIC.
|
* Try to check if the scanner use a known genesys ASIC.
|
||||||
|
@ -3514,50 +3670,55 @@ genesys_read_reg (libusb_device_handle * handle, unsigned char reg,
|
||||||
* @return a string with ASIC name, or NULL if not recognized
|
* @return a string with ASIC name, or NULL if not recognized
|
||||||
*/
|
*/
|
||||||
static char *
|
static char *
|
||||||
check_genesys (struct libusb_device *dev, libusb_device_handle * handle, struct libusb_config_descriptor *config0)
|
check_genesys (libusb_device_handle *handle,
|
||||||
|
struct libusb_device_descriptor desc,
|
||||||
|
struct libusb_config_descriptor *config0)
|
||||||
{
|
{
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int result;
|
int result;
|
||||||
struct libusb_device_descriptor descriptor;
|
|
||||||
|
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf (" checking for GLxxx ...\n");
|
printf (" checking for GLxxx ...\n");
|
||||||
|
|
||||||
|
/* Check GL646 device descriptor */
|
||||||
|
if ((desc.bDeviceClass == LIBUSB_CLASS_PER_INTERFACE)
|
||||||
|
&& (config0->interface[0].altsetting[0].bInterfaceClass == 0x10))
|
||||||
|
{
|
||||||
|
return check_gl646(handle, desc, config0);
|
||||||
|
}
|
||||||
|
if (verbose > 2)
|
||||||
|
{
|
||||||
|
printf
|
||||||
|
(" this is not a GL646 (bDeviceClass = %d, bInterfaceClass = %d)\n",
|
||||||
|
desc.bDeviceClass,
|
||||||
|
config0->interface[0].altsetting[0].bInterfaceClass);
|
||||||
|
}
|
||||||
|
|
||||||
result = libusb_get_device_descriptor (dev, &descriptor);
|
/* Check device desc */
|
||||||
|
if ((desc.bDeviceClass != LIBUSB_CLASS_VENDOR_SPEC)
|
||||||
/* Check device descriptor */
|
|
||||||
if ((descriptor.bDeviceClass != LIBUSB_CLASS_VENDOR_SPEC)
|
|
||||||
|| (config0->interface[0].altsetting[0].bInterfaceClass !=
|
|| (config0->interface[0].altsetting[0].bInterfaceClass !=
|
||||||
LIBUSB_CLASS_VENDOR_SPEC))
|
LIBUSB_CLASS_VENDOR_SPEC))
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf
|
printf
|
||||||
(" this is not a GLxxx (bDeviceClass = %d, bInterfaceClass = %d)\n",
|
(" this is not a GLxxx (bDeviceClass = %d, bInterfaceClass = %d)\n",
|
||||||
descriptor.bDeviceClass,
|
desc.bDeviceClass,
|
||||||
config0->interface[0].altsetting[0].bInterfaceClass);
|
config0->interface[0].altsetting[0].bInterfaceClass);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* USB 2.0 for GL84x+, USB 1.1 for GL646 */
|
|
||||||
if (descriptor.bcdUSB != 0x200
|
if (desc.bDeviceSubClass != 0xff)
|
||||||
&& descriptor.bcdUSB != 0x110)
|
|
||||||
{
|
|
||||||
if (verbose > 2)
|
|
||||||
printf (" this is not a GLxxx (bcdUSB = 0x%x)\n",
|
|
||||||
descriptor.bcdUSB);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (descriptor.bDeviceSubClass != 0xff)
|
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf (" this is not a GLxxx (bDeviceSubClass = 0x%x)\n",
|
printf (" this is not a GLxxx (bDeviceSubClass = 0x%x)\n",
|
||||||
descriptor.bDeviceSubClass);
|
desc.bDeviceSubClass);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (descriptor.bDeviceProtocol != 0xff)
|
if (desc.bDeviceProtocol != 0xff)
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf (" this is not a GLxxx (bDeviceProtocol = 0x%x)\n",
|
printf (" this is not a GLxxx (bDeviceProtocol = 0x%x)\n",
|
||||||
descriptor.bDeviceProtocol);
|
desc.bDeviceProtocol);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3660,96 +3821,48 @@ check_genesys (struct libusb_device *dev, libusb_device_handle * handle, struct
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decide revison number based on bcdUsb heuristics */
|
/* decide revison number based on bcdUsb heuristics */
|
||||||
if (descriptor.bcdDevice == 0x701)
|
if (desc.bcdDevice == 0x701)
|
||||||
return "GL124";
|
return "GL124";
|
||||||
if (descriptor.bcdDevice >= 0x700)
|
if (desc.bcdDevice >= 0x700)
|
||||||
return "GL848+";
|
return "GL848+";
|
||||||
if (descriptor.bcdDevice >= 0x605)
|
if (desc.bcdDevice >= 0x605)
|
||||||
return "GL845";
|
return "GL845";
|
||||||
if (descriptor.bcdDevice >= 0x603)
|
if (desc.bcdDevice >= 0x603)
|
||||||
return "GL847";
|
return "GL847";
|
||||||
if (descriptor.bcdDevice >= 0x600)
|
if (desc.bcdDevice >= 0x600)
|
||||||
return "GL846";
|
return "GL846";
|
||||||
if (descriptor.bcdDevice >= 0x500)
|
if (desc.bcdDevice >= 0x500)
|
||||||
return "GL843";
|
return "GL843";
|
||||||
if (descriptor.bcdDevice >= 0x300)
|
if (desc.bcdDevice >= 0x300)
|
||||||
return "GL842";
|
return "GL842";
|
||||||
if (descriptor.bcdDevice > 0x101)
|
if (desc.bcdDevice > 0x101)
|
||||||
return "GL841";
|
return "GL841";
|
||||||
return "GL646";
|
return "GL646";
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char * check_usb_chip (int verbosity,
|
||||||
check_usb_chip (struct libusb_device *dev, int verbosity, SANE_Bool from_file)
|
struct libusb_device_descriptor desc,
|
||||||
|
libusb_device_handle *hdl,
|
||||||
|
struct libusb_config_descriptor *config0)
|
||||||
{
|
{
|
||||||
char *chip_name = NULL;
|
char *chip_name = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
libusb_device_handle *hdl;
|
|
||||||
struct libusb_device_descriptor desc;
|
|
||||||
struct libusb_config_descriptor *config0;
|
|
||||||
int config;
|
|
||||||
|
|
||||||
verbose = verbosity;
|
verbose = verbosity;
|
||||||
|
|
||||||
/* non working case */
|
|
||||||
if (from_file)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf ("\n<trying to find out which USB chip is used>\n");
|
printf ("\n<trying to find out which USB chip is used>\n");
|
||||||
|
|
||||||
/* open once for all */
|
/* set config if needed */
|
||||||
ret = libusb_open (dev, &hdl);
|
if (desc.bNumConfigurations > 1)
|
||||||
if (ret < 0)
|
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
ret = libusb_set_configuration (hdl, config0->bConfigurationValue);
|
||||||
printf ("could not open USB device\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = libusb_get_configuration (hdl, &config);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
if (verbose > 2)
|
|
||||||
printf ("could not get configuration\n");
|
|
||||||
libusb_close (hdl);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if(config==0)
|
|
||||||
{
|
|
||||||
if (verbose > 2)
|
|
||||||
printf ("device not configured ?\n");
|
|
||||||
libusb_close (hdl);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = libusb_get_device_descriptor (dev, &desc);
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf ("could not get device descriptor\n");
|
printf("couldnt set device to configuration %d\n", config0->bConfigurationValue);
|
||||||
libusb_close (hdl);
|
return NULL;
|
||||||
return NULL;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* get configuration 0 */
|
|
||||||
ret = libusb_get_config_descriptor (dev, 0, &config0);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
if (verbose > 2)
|
|
||||||
printf ("could not get device configuration descriptor 0\n");
|
|
||||||
libusb_close (hdl);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set configuration */
|
|
||||||
ret = libusb_set_configuration (hdl, config0->bConfigurationValue);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
if (verbose > 2)
|
|
||||||
printf ("could not set device configuration\n");
|
|
||||||
libusb_close (hdl);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* claim the interface (only interface 0 is currently handled */
|
/* claim the interface (only interface 0 is currently handled */
|
||||||
|
@ -3758,13 +3871,12 @@ check_usb_chip (struct libusb_device *dev, int verbosity, SANE_Bool from_file)
|
||||||
{
|
{
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
printf ("could not claim USB device interface\n");
|
printf ("could not claim USB device interface\n");
|
||||||
libusb_close (hdl);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now USB is opended and set up, actual chip detection */
|
/* now USB is opended and set up, actual chip detection */
|
||||||
if (!chip_name)
|
if (!chip_name)
|
||||||
chip_name = check_genesys (dev, hdl, config0);
|
chip_name = check_genesys (hdl, desc, config0);
|
||||||
|
|
||||||
if (verbose > 2)
|
if (verbose > 2)
|
||||||
{
|
{
|
||||||
|
@ -3777,11 +3889,8 @@ check_usb_chip (struct libusb_device *dev, int verbosity, SANE_Bool from_file)
|
||||||
PACKAGE_STRING);
|
PACKAGE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* release and close USB device */
|
/* close USB device */
|
||||||
libusb_free_config_descriptor (config0);
|
|
||||||
libusb_free_config_descriptor (config);
|
|
||||||
libusb_release_interface (hdl, 0);
|
libusb_release_interface (hdl, 0);
|
||||||
libusb_close (hdl);
|
|
||||||
return chip_name;
|
return chip_name;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBUSB_1_0 */
|
#endif /* HAVE_LIBUSB_1_0 */
|
||||||
|
|
|
@ -57,7 +57,10 @@ extern char * check_usb_chip (struct usb_device *dev, int verbosity, SANE_Bool f
|
||||||
|
|
||||||
#ifdef HAVE_LIBUSB_1_0
|
#ifdef HAVE_LIBUSB_1_0
|
||||||
#include <libusb.h>
|
#include <libusb.h>
|
||||||
extern char * check_usb_chip (struct libusb_device *dev, int verbosity, SANE_Bool from_file);
|
extern char * check_usb_chip (int verbosity,
|
||||||
|
struct libusb_device_descriptor desc,
|
||||||
|
libusb_device_handle *hdl,
|
||||||
|
struct libusb_config_descriptor *config0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../include/sane/sanei_usb.h"
|
#include "../include/sane/sanei_usb.h"
|
||||||
|
@ -1021,7 +1024,6 @@ check_libusb_device (libusb_device *dev, SANE_Bool from_file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_close (hdl);
|
|
||||||
|
|
||||||
/* Some heuristics, which device may be a scanner */
|
/* Some heuristics, which device may be a scanner */
|
||||||
if (desc.idVendor == 0) /* hub */
|
if (desc.idVendor == 0) /* hub */
|
||||||
|
@ -1061,11 +1063,12 @@ check_libusb_device (libusb_device *dev, SANE_Bool from_file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_config_descriptor (config0);
|
|
||||||
|
|
||||||
if (is_scanner > 0)
|
if (is_scanner > 0)
|
||||||
{
|
{
|
||||||
char *chipset = check_usb_chip (dev, verbose, from_file);
|
char *chipset = NULL;
|
||||||
|
|
||||||
|
if(!from_file)
|
||||||
|
chipset = check_usb_chip (verbose, desc, hdl, config0);
|
||||||
|
|
||||||
printf ("found USB scanner (vendor=0x%04x", vid);
|
printf ("found USB scanner (vendor=0x%04x", vid);
|
||||||
if (vendor)
|
if (vendor)
|
||||||
|
@ -1083,8 +1086,11 @@ check_libusb_device (libusb_device *dev, SANE_Bool from_file)
|
||||||
libusb_device_found = SANE_TRUE;
|
libusb_device_found = SANE_TRUE;
|
||||||
device_found = SANE_TRUE;
|
device_found = SANE_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
libusb_free_config_descriptor (config0);
|
||||||
|
|
||||||
out_free:
|
out_free:
|
||||||
|
libusb_close (hdl);
|
||||||
if (vendor)
|
if (vendor)
|
||||||
free (vendor);
|
free (vendor);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue