[Pcsclite-cvs-commit] r3378 - in /trunk/Drivers/ccid: configure.in src/ccid.c src/ccid.h src/ccid_usb.c src/ifdhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Mar 26 14:34:36 UTC 2009


Author: rousseau
Date: Thu Mar 26 14:34:35 2009
New Revision: 3378

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3378
Log:
add support of a composite device as multi-slots device

Modified:
    trunk/Drivers/ccid/configure.in
    trunk/Drivers/ccid/src/ccid.c
    trunk/Drivers/ccid/src/ccid.h
    trunk/Drivers/ccid/src/ccid_usb.c
    trunk/Drivers/ccid/src/ifdhandler.c

Modified: trunk/Drivers/ccid/configure.in
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/configure.in?rev=3378&op=diff
==============================================================================
--- trunk/Drivers/ccid/configure.in (original)
+++ trunk/Drivers/ccid/configure.in Thu Mar 26 14:34:35 2009
@@ -179,6 +179,17 @@
 	instead of polling])
 fi
 
+# --enable-composite-as-multislot
+use_composite_as_multislot=no
+AC_ARG_ENABLE(composite-as-multislot,
+	AC_HELP_STRING([--enable-composite-as-multislot],
+		[composite device are seen as multi-slots]),
+	[ use_composite_as_multislot="${enableval}" ] )
+
+if test "x$use_composite_as_multislot" = xyes; then
+	AC_DEFINE(USE_COMPOSITE_AS_MULTISLOT, 1, [composite device are seen as multi-slots])
+fi
+
 # check if the compiler support -fvisibility=hidden (GCC >= 4)
 saved_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS -fvisibility=hidden"
@@ -306,6 +317,7 @@
 
 libusb support:          ${use_libusb}
 use USB interrupt:       ${use_usb_interrupt}
+composite as multislot:  ${use_composite_as_multislot}
 multi threading:         ${multithread}
 bundle directory name:   ${bundle}
 USB drop directory:      ${usbdropdir}

Modified: trunk/Drivers/ccid/src/ccid.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.c?rev=3378&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.c (original)
+++ trunk/Drivers/ccid/src/ccid.c Thu Mar 26 14:34:35 2009
@@ -288,6 +288,29 @@
 			(void)InterruptRead(reader_index);
 #endif
 			break;
+
+#ifndef USE_USB_INTERRUPT
+		/* only if we do not use USB interrupts */
+		case GEMALTOPROXDU:
+		case GEMALTOPROXSU:
+			{
+				/* disable card movements notification
+				 * with RDR_to_PC_NotifySlotChange */
+				unsigned char cmd[] = { 0x42, 0x00 /* disable */};
+				unsigned char res[10];
+				unsigned int length_res = sizeof(res);
+
+				if (CmdEscape(reader_index, cmd, sizeof(cmd), res, &length_res) == IFD_SUCCESS)
+				{
+					DEBUG_COMM("NotifySlotChange disabled");
+				}
+				else
+				{
+					DEBUG_CRITICAL("NotifySlotChange disabling failed");
+				}
+			}
+			break;
+#endif
 	}
 
 	/* ICCD type A */

Modified: trunk/Drivers/ccid/src/ccid.h
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.h?rev=3378&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.h (original)
+++ trunk/Drivers/ccid/src/ccid.h Thu Mar 26 14:34:35 2009
@@ -152,6 +152,8 @@
 #define GEMPCPINPAD 0x08E63478
 #define GEMCORESIMPRO 0x08E63480
 #define GEMCOREPOSPRO 0x08E63479
+#define GEMALTOPROXDU 0x08E65503
+#define GEMALTOPROXSU 0x08E65504
 #define CARDMAN3121	0x076B3021
 #define LTC31		0x07830003
 #define SCR331DI	0x04E65111

Modified: trunk/Drivers/ccid/src/ccid_usb.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid_usb.c?rev=3378&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid_usb.c (original)
+++ trunk/Drivers/ccid/src/ccid_usb.c Thu Mar 26 14:34:35 2009
@@ -358,6 +358,27 @@
 					int interface;
 					int num = 0;
 
+#ifdef USE_COMPOSITE_AS_MULTISLOT
+					{
+						/* simulate a composite device as when libhal is
+						 * used */
+						int readerID = (vendorID << 16) + productID;
+
+						if ((GEMALTOPROXDU == readerID)
+							|| (GEMALTOPROXSU == readerID))
+						{
+							if(interface_number >= 0)
+							{
+								DEBUG_CRITICAL("USE_COMPOSITE_AS_MULTISLOT can't be used with libhal");
+								continue;
+							}
+
+							/* the CCID interfaces are 1 and 2 */
+							static int static_interface = 1;
+							interface_number = static_interface++;
+						}
+					}
+#endif
 					/* is it already opened? */
 					already_used = FALSE;
 

Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=3378&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Thu Mar 26 14:34:35 2009
@@ -374,6 +374,17 @@
 			{
 				*Length = 1;
 				*Value = 1 + get_ccid_descriptor(reader_index) -> bMaxSlotIndex;
+#ifdef USE_COMPOSITE_AS_MULTISLOT
+				{
+					/* On MacOS X or Linux+libusb we can simulate a
+					 * composite device with 2 CCID interfaces by a
+					 * multi-slot reader */
+					int readerID =  get_ccid_descriptor(reader_index) -> readerID;
+
+					if ((GEMALTOPROXDU == readerID) || (GEMALTOPROXSU == readerID))
+						*Value = 2;
+				}
+#endif
 				DEBUG_INFO2("Reader supports %d slot(s)", *Value);
 			}
 			break;




More information about the Pcsclite-cvs-commit mailing list