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

Ludovic Rousseau rousseau at costa.debian.org
Wed Sep 6 15:49:40 CEST 2006


Author: rousseau
Date: 2006-09-06 13:49:40 +0000 (Wed, 06 Sep 2006)
New Revision: 2150

Modified:
   trunk/Drivers/ccid/src/ifdhandler.c
Log:
IFDHICCPresence(): correctly support the removal and insertion between
two consecutive IFDHICCPresence() calls


Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c	2006-09-05 16:41:05 UTC (rev 2149)
+++ trunk/Drivers/ccid/src/ifdhandler.c	2006-09-06 13:49:40 UTC (rev 2150)
@@ -1086,11 +1086,24 @@
 	switch (pcbuffer[7] & CCID_ICC_STATUS_MASK)	/* bStatus */
 	{
 		case CCID_ICC_PRESENT_ACTIVE:
-		case CCID_ICC_PRESENT_INACTIVE:
 			return_value = IFD_ICC_PRESENT;
 			/* use default slot */
 			break;
 
+		case CCID_ICC_PRESENT_INACTIVE:
+			if (CcidSlots[reader_index].bPowerFlags == POWERFLAGS_RAZ)
+				/* the card was previously absent */
+				return_value = IFD_ICC_PRESENT;
+			else
+			{
+				/* the card was previously present but has been
+				 * removed and inserted between two consecutive
+				 * IFDHICCPresence() calls */
+				CcidSlots[reader_index].bPowerFlags = POWERFLAGS_RAZ;
+				return_value = IFD_ICC_NOT_PRESENT;
+			}
+			break;
+
 		case CCID_ICC_ABSENT:
 			/* Reset ATR buffer */
 			CcidSlots[reader_index].nATRLength = 0;




More information about the Pcsclite-cvs-commit mailing list