Added test for Genesys Logig GL660 + GL646 combination. Added some more

messages about what's going on.
merge-requests/1/head
Henning Geinitz 2003-07-29 15:57:23 +00:00
rodzic 2cb2ea8b61
commit 0a40fd4dc6
2 zmienionych plików z 182 dodań i 21 usunięć

Wyświetl plik

@ -2,6 +2,8 @@
* doc/descriptions/unsupported.desc: Added Minolta and Visioneer
scanners. Updated Avision, Medion, and UMAX scanners.
* tools/check-usb-chip.c: Added test for Genesys Logig GL660 +
GL646 combination. Added some more messages about what's going on.
2003-07-29 Matthew Duggan <stauff1@users.sourceforge.net>

Wyświetl plik

@ -1181,6 +1181,159 @@ check_gl646 (struct usb_device *dev)
return "GL646";
}
/* check for the combination of gl660 and gl646 */
static char *
check_gl660_gl646 (struct usb_device *dev)
{
unsigned char val;
int result;
usb_dev_handle *handle;
if (verbose > 2)
printf (" checking for GL660+GL646 ...\n");
/* Check device descriptor */
if ((dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC)
|| (dev->config[0].interface[0].altsetting[0].bInterfaceClass != USB_CLASS_PER_INTERFACE))
{
if (verbose > 2)
printf
(" this is not a GL660+GL646 (bDeviceClass = %d, bInterfaceClass = %d)\n",
dev->descriptor.bDeviceClass,
dev->config[0].interface[0].altsetting[0].bInterfaceClass);
return 0;
}
if (dev->descriptor.bcdUSB != 0x200)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (bcdUSB = 0x%x)\n",
dev->descriptor.bcdUSB);
return 0;
}
if (dev->descriptor.bDeviceSubClass != 0xff)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (bDeviceSubClass = 0x%x)\n",
dev->descriptor.bDeviceSubClass);
return 0;
}
if (dev->descriptor.bDeviceProtocol != 0xff)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (bDeviceProtocol = 0x%x)\n",
dev->descriptor.bDeviceProtocol);
return 0;
}
/* Check endpoints */
if (dev->config[0].interface[0].altsetting[0].bNumEndpoints != 3)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (bNumEndpoints = %d)\n",
dev->config[0].interface[0].altsetting[0].bNumEndpoints);
return 0;
}
if ((dev->config[0].interface[0].altsetting[0].endpoint[0].
bEndpointAddress != 0x81)
|| (dev->config[0].interface[0].altsetting[0].endpoint[0].
bmAttributes != 0x02)
|| (dev->config[0].interface[0].altsetting[0].endpoint[0].
wMaxPacketSize != 0x40)
|| (dev->config[0].interface[0].altsetting[0].endpoint[0].bInterval !=
0x0))
{
if (verbose > 2)
printf
(" this is not a GL660+GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
dev->config[0].interface[0].altsetting[0].endpoint[0].
bEndpointAddress,
dev->config[0].interface[0].altsetting[0].endpoint[0].bmAttributes,
dev->config[0].interface[0].altsetting[0].endpoint[0].
wMaxPacketSize,
dev->config[0].interface[0].altsetting[0].endpoint[0].bInterval);
return 0;
}
if ((dev->config[0].interface[0].altsetting[0].endpoint[1].
bEndpointAddress != 0x02)
|| (dev->config[0].interface[0].altsetting[0].endpoint[1].
bmAttributes != 0x02)
|| (dev->config[0].interface[0].altsetting[0].endpoint[1].
wMaxPacketSize != 0x40)
|| (dev->config[0].interface[0].altsetting[0].endpoint[1].bInterval !=
0))
{
if (verbose > 2)
printf
(" this is not a GL660+GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
dev->config[0].interface[0].altsetting[0].endpoint[1].
bEndpointAddress,
dev->config[0].interface[0].altsetting[0].endpoint[1].bmAttributes,
dev->config[0].interface[0].altsetting[0].endpoint[1].
wMaxPacketSize,
dev->config[0].interface[0].altsetting[0].endpoint[1].bInterval);
return 0;
}
if ((dev->config[0].interface[0].altsetting[0].endpoint[2].
bEndpointAddress != 0x83)
|| (dev->config[0].interface[0].altsetting[0].endpoint[2].
bmAttributes != 0x03)
|| (dev->config[0].interface[0].altsetting[0].endpoint[2].
wMaxPacketSize != 0x1)
|| (dev->config[0].interface[0].altsetting[0].endpoint[2].bInterval !=
8))
{
if (verbose > 2)
printf
(" this is not a GL660+GL646 (bEndpointAddress = 0x%x, bmAttributes = 0x%x, "
"wMaxPacketSize = 0x%x, bInterval = 0x%x)\n",
dev->config[0].interface[0].altsetting[0].endpoint[2].
bEndpointAddress,
dev->config[0].interface[0].altsetting[0].endpoint[2].bmAttributes,
dev->config[0].interface[0].altsetting[0].endpoint[2].
wMaxPacketSize,
dev->config[0].interface[0].altsetting[0].endpoint[2].bInterval);
return 0;
}
result = prepare_interface (dev, &handle);
if (!result)
return "GL660+GL646?";
result = gl646_write_reg (handle, 0x38, 0x15);
if (!result)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (writing register failed)\n");
finish_interface (handle);
return 0;
}
result = gl646_read_reg (handle, 0x4e, &val);
if (!result)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (reading register failed)\n");
finish_interface (handle);
return 0;
}
if (val != 0x15)
{
if (verbose > 2)
printf (" this is not a GL660+GL646 (reg 0x4e != reg 0x38)\n");
finish_interface (handle);
return 0;
}
finish_interface (handle);
return "GL660+GL646";
}
char *
check_usb_chip (struct usb_device *dev, int verbosity)
@ -1189,35 +1342,41 @@ check_usb_chip (struct usb_device *dev, int verbosity)
verbose = verbosity;
if (verbose > 2)
printf ("\n<trying to find out which USB chip is used>\n");
chip_name = check_gt6801 (dev);
if (chip_name)
return chip_name;
chip_name = check_gt6816 (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_gt6816 (dev);
chip_name = check_ma1017 (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_ma1017 (dev);
chip_name = check_ma1015 (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_ma1015 (dev);
chip_name = check_ma1509 (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_ma1509 (dev);
chip_name = check_merlin (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_merlin (dev);
chip_name = check_gl646 (dev);
if (chip_name)
return chip_name;
if (!chip_name)
chip_name = check_gl646 (dev);
return 0; /* unknown chipset */
if (!chip_name)
chip_name = check_gl660_gl646 (dev);
if (verbose > 2)
{
if (chip_name)
printf ("<This USB chip looks like a %s>\n\n", chip_name);
else
printf ("<Couldn't determine the type of the USB chip>\n\n");
}
return chip_name;
}
#endif /* HAVE_LIBUSB */