[Pcsclite-cvs-commit] r3406 - /trunk/Drivers/ccid/src/ccid_usb.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Mar 31 12:48:22 UTC 2009


Author: rousseau
Date: Tue Mar 31 12:48:21 2009
New Revision: 3406

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3406
Log:
OpenUSBByName(): only increase the interface number for the next "slot"
if the previous interface was opened correctly

It is now posible to use 2 composite readers without libusb and libhal
scheme

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

Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=3406&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Tue Mar 31 12:48:21 2009
@@ -357,6 +357,7 @@
 					struct usb_interface *usb_interface = NULL;
 					int interface;
 					int num = 0;
+					static int static_interface = 1;
 
 #ifdef USE_COMPOSITE_AS_MULTISLOT
 					{
@@ -374,12 +375,7 @@
 							}
 
 							/* the CCID interfaces are 1 and 2 */
-							static int static_interface = 1;
-							interface_number = static_interface++;
-
-							/* reset for a next reader */
-							if (static_interface > 2)
-								static_interface = 1;
+							interface_number = static_interface;
 						}
 					}
 #endif
@@ -499,7 +495,8 @@
 						(void)usb_close(dev_handle);
 						DEBUG_CRITICAL4("Can't claim interface %s/%s: %s",
 							bus->dirname, dev->filename, strerror(errno));
-						return STATUS_UNSUCCESSFUL;
+						interface_number = -1;
+						continue;
 					}
 
 					DEBUG_INFO4("Found Vendor/Product: %04X/%04X (%s)",
@@ -514,6 +511,15 @@
 						(void)usb_close(dev_handle);
 						return STATUS_UNSUCCESSFUL;
 					}
+
+#ifdef USE_COMPOSITE_AS_MULTISLOT
+					/* use the next interface for the next "slot" */
+					static_interface++;
+
+					/* reset for a next reader */
+					if (static_interface > 2)
+						static_interface = 1;
+#endif
 
 					/* Get Endpoints values*/
 					(void)get_end_points(dev, &usbDevice[reader_index], num);




More information about the Pcsclite-cvs-commit mailing list