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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Mar 30 09:04:52 UTC 2009


Author: rousseau
Date: Mon Mar 30 09:04:52 2009
New Revision: 3404

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3404
Log:
move hack code for GemPC Key, GemPC Twin, GemPC pinpad, GemProx DU
GemProx SU and SCM contactless readers from ccid_open_hack_pre() to
ccid_open_hack_post()

We first need to get a correct communication (sync USB togggle bit)
before sending the control commands

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

Modified: trunk/Drivers/ccid/src/ccid.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ccid.c?rev=3404&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ccid.c (original)
+++ trunk/Drivers/ccid/src/ccid.c Mon Mar 30 09:04:52 2009
@@ -52,6 +52,69 @@
 			ccid_descriptor->dwFeatures |= CCID_CLASS_TPDU;
 			break;
 
+		case MYSMARTPAD:
+			ccid_descriptor->dwMaxIFSD = 254;
+			break;
+
+		case CL1356D:
+			/* the firmware needs some time to initialize */
+			(void)sleep(1);
+			ccid_descriptor->readTimeout = 60; /* 60 seconds */
+			break;
+
+		case SEG:
+#ifndef TWIN_SERIAL
+			(void)InterruptRead(reader_index);
+#endif
+			break;
+	}
+
+	/* ICCD type A */
+	if (ICCD_A == ccid_descriptor->bInterfaceProtocol)
+	{
+		unsigned char tmp[MAX_ATR_SIZE];
+		unsigned int n = sizeof(tmp);
+
+		DEBUG_COMM("ICCD type A");
+		(void)CmdPowerOff(reader_index);
+		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
+		(void)CmdPowerOff(reader_index);
+	}
+
+	/* ICCD type B */
+	if (ICCD_B == ccid_descriptor->bInterfaceProtocol)
+	{
+		unsigned char tmp[MAX_ATR_SIZE];
+		unsigned int n = sizeof(tmp);
+
+		DEBUG_COMM("ICCD type B");
+		if (CCID_CLASS_SHORT_APDU ==
+			(ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK))
+		{
+			/* use the extended APDU comm alogorithm */
+			ccid_descriptor->dwFeatures &= ~CCID_CLASS_EXCHANGE_MASK;
+			ccid_descriptor->dwFeatures |= CCID_CLASS_EXTENDED_APDU;
+		}
+
+		(void)CmdPowerOff(reader_index);
+		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
+		(void)CmdPowerOff(reader_index);
+	}
+
+	return 0;
+} /* ccid_open_hack_pre */
+
+/*****************************************************************************
+ *
+ *					ccid_open_hack_post
+ *
+ ****************************************************************************/
+int ccid_open_hack_post(unsigned int reader_index)
+{
+	_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
+
+	switch (ccid_descriptor->readerID)
+	{
 		case GEMPCKEY:
 		case GEMPCTWIN:
 			/* Reader announces TPDU but can do APDU */
@@ -273,22 +336,6 @@
 			break;
 #endif
 
-		case MYSMARTPAD:
-			ccid_descriptor->dwMaxIFSD = 254;
-			break;
-
-		case CL1356D:
-			/* the firmware needs some time to initialize */
-			(void)sleep(1);
-			ccid_descriptor->readTimeout = 60; /* 60 seconds */
-			break;
-
-		case SEG:
-#ifndef TWIN_SERIAL
-			(void)InterruptRead(reader_index);
-#endif
-			break;
-
 #ifndef USE_USB_INTERRUPT
 		/* only if we do not use USB interrupts */
 		case GEMALTOPROXDU:
@@ -311,54 +358,6 @@
 			}
 			break;
 #endif
-	}
-
-	/* ICCD type A */
-	if (ICCD_A == ccid_descriptor->bInterfaceProtocol)
-	{
-		unsigned char tmp[MAX_ATR_SIZE];
-		unsigned int n = sizeof(tmp);
-
-		DEBUG_COMM("ICCD type A");
-		(void)CmdPowerOff(reader_index);
-		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
-		(void)CmdPowerOff(reader_index);
-	}
-
-	/* ICCD type B */
-	if (ICCD_B == ccid_descriptor->bInterfaceProtocol)
-	{
-		unsigned char tmp[MAX_ATR_SIZE];
-		unsigned int n = sizeof(tmp);
-
-		DEBUG_COMM("ICCD type B");
-		if (CCID_CLASS_SHORT_APDU ==
-			(ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK))
-		{
-			/* use the extended APDU comm alogorithm */
-			ccid_descriptor->dwFeatures &= ~CCID_CLASS_EXCHANGE_MASK;
-			ccid_descriptor->dwFeatures |= CCID_CLASS_EXTENDED_APDU;
-		}
-
-		(void)CmdPowerOff(reader_index);
-		(void)CmdPowerOn(reader_index, &n, tmp, CCID_CLASS_AUTO_VOLTAGE);
-		(void)CmdPowerOff(reader_index);
-	}
-
-	return 0;
-} /* ccid_open_hack_pre */
-
-/*****************************************************************************
- *
- *					ccid_open_hack_post
- *
- ****************************************************************************/
-int ccid_open_hack_post(unsigned int reader_index)
-{
-	_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
-
-	switch (ccid_descriptor->readerID)
-	{
 	}
 
 	return 0;




More information about the Pcsclite-cvs-commit mailing list