[Pcsclite-cvs-commit] r6793 - trunk/Drivers/ccid/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Mon Nov 25 13:09:41 UTC 2013


Author: rousseau
Date: 2013-11-25 13:09:41 +0000 (Mon, 25 Nov 2013)
New Revision: 6793

Modified:
   trunk/Drivers/ccid/src/ccid_usb.c
Log:
Generalize the management of readers with bDeviceClass = 0xFF

Some early Gemalto Ezio CB+ readers have bDeviceClass, bDeviceSubClass and
bDeviceProtocol set to 0xFF (proprietary) instead of 0x00.

So on Mac OS X the reader configuration is not done by the OS/kernel and we do
it ourself.

The code is no more limited to the GEMALTO_EZIO_CBP (0x08E6/0x34C3) but to any
reader with the problem, like the Todos Argos Mini II CCID.


Modified: trunk/Drivers/ccid/src/ccid_usb.c
===================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c	2013-11-25 13:03:21 UTC (rev 6792)
+++ trunk/Drivers/ccid/src/ccid_usb.c	2013-11-25 13:09:41 UTC (rev 6793)
@@ -497,35 +497,45 @@
 				}
 
 again:
+				r = libusb_get_active_config_descriptor(dev, &config_desc);
+				if (r < 0)
+				{
 #ifdef __APPLE__
-				/* Some early Gemalto Ezio CB+ readers have
-				 * bDeviceClass, bDeviceSubClass and bDeviceProtocol set
-				 * to 0xFF (proprietary) instead of 0x00.
-				 *
-				 * So on Mac OS X the reader configuration is not done
-				 * by the OS/kernel and we do it ourself.
-				 */
-				if (GEMALTO_EZIO_CBP == readerID)
-				{
-					r = libusb_set_configuration(dev_handle, 1);
+					/* Some early Gemalto Ezio CB+ readers have
+					 * bDeviceClass, bDeviceSubClass and bDeviceProtocol set
+					 * to 0xFF (proprietary) instead of 0x00.
+					 *
+					 * So on Mac OS X the reader configuration is not done
+					 * by the OS/kernel and we do it ourself.
+					 */
+					if ((0xFF == desc.bDeviceClass)
+						&& (0xFF == desc.bDeviceSubClass)
+						&& (0xFF == desc.bDeviceProtocol))
+					{
+						r = libusb_set_configuration(dev_handle, 1);
+						if (r < 0)
+						{
+							(void)libusb_close(dev_handle);
+							DEBUG_CRITICAL4("Can't set configuration on %d/%d: %d",
+									bus_number, device_address, r);
+							continue;
+						}
+					}
+
+					/* recall */
+					r = libusb_get_active_config_descriptor(dev, &config_desc);
 					if (r < 0)
 					{
+#endif
 						(void)libusb_close(dev_handle);
-						DEBUG_CRITICAL4("Can't set configuration on %d/%d: %d",
+						DEBUG_CRITICAL4("Can't get config descriptor on %d/%d: %d",
 							bus_number, device_address, r);
 						continue;
 					}
+#ifdef __APPLE__
 				}
 #endif
 
-				r = libusb_get_active_config_descriptor(dev, &config_desc);
-				if (r < 0)
-				{
-					(void)libusb_close(dev_handle);
-					DEBUG_CRITICAL4("Can't get config descriptor on %d/%d: %d",
-						bus_number, device_address, r);
-					continue;
-				}
 
 				usb_interface = get_ccid_usb_interface(config_desc, &num);
 				if (usb_interface == NULL)




More information about the Pcsclite-cvs-commit mailing list