kopia lustrzana https://gitlab.com/sane-project/backends
cleanups and final version
rodzic
3af775de44
commit
4bc8ce9b8b
|
@ -3470,12 +3470,7 @@ genesys_write_reg (libusb_device_handle *handle, unsigned char reg,
|
|||
|
||||
result = libusb_control_transfer (handle,
|
||||
0x40,
|
||||
0x04,
|
||||
0x83,
|
||||
0x00,
|
||||
data,
|
||||
0x02,
|
||||
TIMEOUT);
|
||||
0x04, 0x83, 0x00, data, 0x02, TIMEOUT);
|
||||
if (result < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
@ -3489,23 +3484,13 @@ genesys_read_reg (libusb_device_handle * handle, unsigned char reg,
|
|||
|
||||
result = libusb_control_transfer (handle,
|
||||
0x40,
|
||||
0x0c,
|
||||
0x83,
|
||||
0x00,
|
||||
®,
|
||||
0x01,
|
||||
TIMEOUT);
|
||||
0x0c, 0x83, 0x00, ®, 0x01, TIMEOUT);
|
||||
if (result < 0)
|
||||
return 0;
|
||||
|
||||
result = libusb_control_transfer (handle,
|
||||
0xc0,
|
||||
0x0c,
|
||||
0x84,
|
||||
0x00,
|
||||
val,
|
||||
0x01,
|
||||
TIMEOUT);
|
||||
0x0c, 0x84, 0x00, val, 0x01, TIMEOUT);
|
||||
if (result < 0)
|
||||
return 0;
|
||||
|
||||
|
@ -3530,8 +3515,7 @@ check_gl646 (libusb_device_handle *handle,
|
|||
if (desc.bcdUSB != 0x110)
|
||||
{
|
||||
if (verbose > 2)
|
||||
printf (" this is not a GL646 (bcdUSB = 0x%x)\n",
|
||||
desc.bcdUSB);
|
||||
printf (" this is not a GL646 (bcdUSB = 0x%x)\n", desc.bcdUSB);
|
||||
return 0;
|
||||
}
|
||||
if (desc.bDeviceSubClass != 0x00)
|
||||
|
@ -3558,68 +3542,59 @@ check_gl646 (libusb_device_handle *handle,
|
|||
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 ((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].bEndpointAddress,
|
||||
config0->interface[0].altsetting[0].endpoint[0].bmAttributes,
|
||||
config0->interface[0].altsetting[0].endpoint[0].
|
||||
wMaxPacketSize,
|
||||
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 ((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].bEndpointAddress,
|
||||
config0->interface[0].altsetting[0].endpoint[1].bmAttributes,
|
||||
config0->interface[0].altsetting[0].endpoint[1].
|
||||
wMaxPacketSize,
|
||||
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 ((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].bEndpointAddress,
|
||||
config0->interface[0].altsetting[0].endpoint[2].bmAttributes,
|
||||
config0->interface[0].altsetting[0].endpoint[2].
|
||||
wMaxPacketSize,
|
||||
config0->interface[0].altsetting[0].endpoint[2].wMaxPacketSize,
|
||||
config0->interface[0].altsetting[0].endpoint[2].bInterval);
|
||||
return 0;
|
||||
}
|
||||
|
@ -3820,7 +3795,7 @@ check_genesys (libusb_device_handle *handle,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/* decide revison number based on bcdUsb heuristics */
|
||||
/* decide revision number based on bcdUsb heuristics */
|
||||
if (desc.bcdDevice == 0x701)
|
||||
return "GL124";
|
||||
if (desc.bcdDevice >= 0x700)
|
||||
|
@ -3837,10 +3812,11 @@ check_genesys (libusb_device_handle *handle,
|
|||
return "GL842";
|
||||
if (desc.bcdDevice > 0x101)
|
||||
return "GL841";
|
||||
return "GL646";
|
||||
return "GL646_HP";
|
||||
}
|
||||
|
||||
char * check_usb_chip (int verbosity,
|
||||
char *
|
||||
check_usb_chip (int verbosity,
|
||||
struct libusb_device_descriptor desc,
|
||||
libusb_device_handle * hdl,
|
||||
struct libusb_config_descriptor *config0)
|
||||
|
@ -3860,7 +3836,8 @@ char * check_usb_chip (int verbosity,
|
|||
if (ret < 0)
|
||||
{
|
||||
if (verbose > 2)
|
||||
printf("couldnt set device to configuration %d\n", config0->bConfigurationValue);
|
||||
printf ("couldnt set device to configuration %d\n",
|
||||
config0->bConfigurationValue);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue