[Pcsclite-cvs-commit] Drivers/ccid/src ifdhandler.c,1.48,1.49

rousseau@haydn.debian.org rousseau@haydn.debian.org


Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv24910

Modified Files:
	ifdhandler.c 
Log Message:
use a much cleaner way to check presence of a contactless card with a 
multislot SCR331-DI reader


Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- ifdhandler.c	6 Aug 2004 11:25:46 -0000	1.48
+++ ifdhandler.c	6 Aug 2004 11:30:33 -0000	1.49
@@ -901,7 +901,6 @@
 		case 0x01:
 			return_value = IFD_ICC_PRESENT;
 			/* use default slot */
-			ccid_descriptor->bCurrentSlotIndex = 0;
 			break;
 
 		case 0x02:
@@ -918,7 +917,7 @@
 
 	/* SCR331-DI contactless reader */
 	if ((SCR331DI == ccid_descriptor->readerID)
-		&& (ccid_descriptor->bMaxSlotIndex > 0))
+		&& (ccid_descriptor->bCurrentSlotIndex > 0))
 	{
 		unsigned char cmd[] = { 0x11 };
 		/*  command: 11 ??
@@ -939,17 +938,17 @@
 		LogLevel = oldLogLevel;
 
 		if (0x01 == res[0])
-		{
 			return_value = IFD_ICC_PRESENT;
+		else
+		{
+			/* Reset ATR buffer */
+			CcidSlots[reader_index].nATRLength = 0;
+			*CcidSlots[reader_index].pcATRBuffer = '\0';
 
-			/* the contactless reader is in the slot 1 */
-			ccid_descriptor->bCurrentSlotIndex = 1;
-
-			/* hack since the contactless reader do not share dwFeatures */
-			ccid_descriptor->dwFeatures &= ~CCID_CLASS_EXCHANGE_MASK;
-			ccid_descriptor->dwFeatures |= CCID_CLASS_SHORT_APDU;
+			/* Reset PowerFlags */
+			CcidSlots[reader_index].bPowerFlags = POWERFLAGS_RAZ;
 
-			ccid_descriptor->dwFeatures |= CCID_CLASS_AUTO_IFSD;
+			return_value = IFD_ICC_NOT_PRESENT;
 		}
 	}