[Pcsclite-cvs-commit] r5474 - /trunk/Drivers/ccid/src/parse.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jan 4 09:53:35 UTC 2011


Author: rousseau
Date: Tue Jan  4 09:53:35 2011
New Revision: 5474

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5474
Log:
Use get_ccid_device_descriptor() instead of using
usb_interface_descriptor->extra directly to support "bogus" readers

Modified:
    trunk/Drivers/ccid/src/parse.c

Modified: trunk/Drivers/ccid/src/parse.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/parse.c?rev=5474&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/parse.c (original)
+++ trunk/Drivers/ccid/src/parse.c Tue Jan  4 09:53:35 2011
@@ -54,7 +54,8 @@
 static int ccid_parse_interface_descriptor(libusb_device_handle *handle,
 	struct libusb_device_descriptor desc,
 	struct libusb_config_descriptor *config_desc,
-	int num);
+	int num,
+	const struct libusb_interface *usb_interface);
 
 
 /*****************************************************************************
@@ -207,7 +208,8 @@
 		}
 #endif
 
-		(void)ccid_parse_interface_descriptor(handle, desc, config_desc, num);
+		(void)ccid_parse_interface_descriptor(handle, desc, config_desc, num,
+			usb_interface);
 
 #ifndef __APPLE__
 		(void)libusb_release_interface(handle, interface);
@@ -238,7 +240,8 @@
 static int ccid_parse_interface_descriptor(libusb_device_handle *handle,
 	struct libusb_device_descriptor desc, 
 	struct libusb_config_descriptor *config_desc,
-	int num)
+	int num,
+	const struct libusb_interface *usb_interface)
 {
 	const struct libusb_interface_descriptor *usb_interface_descriptor;
 	const unsigned char *device_descriptor;
@@ -345,10 +348,9 @@
 	else
 		(void)printf(" iInterface: %s\n", buffer);
 
-	if (usb_interface_descriptor->extra_length < 54)
-	{
-		(void)printf("USB extra length is too short: %d\n",
-			usb_interface_descriptor->extra_length);
+	device_descriptor = get_ccid_device_descriptor(usb_interface);
+	if (NULL == device_descriptor)
+	{
 		(void)printf("\n  NOT A CCID DEVICE\n");
 		return TRUE;
 	}
@@ -357,7 +359,6 @@
 	 * CCID Class Descriptor
 	 */
 	(void)printf(" CCID Class Descriptor\n");
-	device_descriptor = usb_interface_descriptor->extra;
 
 	(void)printf("  bLength: 0x%02X\n", device_descriptor[0]);
 	if (device_descriptor[0] != 0x36)




More information about the Pcsclite-cvs-commit mailing list