[Pcsclite-cvs-commit] Drivers/ccid/src ifdhandler.c,1.25,1.26

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


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

Modified Files:
	ifdhandler.c 
Log Message:
reset ATR string (length = 0) when teh card is powered down or not present


Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ifdhandler.c	19 Apr 2004 16:09:24 -0000	1.25
+++ ifdhandler.c	19 Apr 2004 16:18:43 -0000	1.26
@@ -553,14 +553,18 @@
 	switch (pcbuffer[7])	/* bStatus */
 	{
 		case 0x00:
-			return_value = IFD_ICC_PRESENT;
-			break;
-
 		case 0x01:
 			return_value = IFD_ICC_PRESENT;
 			break;
 
 		case 0x02:
+			/* Reset ATR buffer */
+			CcidSlots[LunToReaderIndex(Lun)].nATRLength = 0;
+			*CcidSlots[LunToReaderIndex(Lun)].pcATRBuffer = '\0';
+
+			/* Reset PowerFlags */
+			CcidSlots[LunToReaderIndex(Lun)].bPowerFlags = POWERFLAGS_RAZ;
+
 			return_value = IFD_ICC_NOT_PRESENT;
 			break;
 	}
@@ -710,6 +714,13 @@
 {
 	/* clear T=1 context */
 	Protocol_T1_Close(&((get_ccid_slot(lun)) -> t1));
+
+	/* Reset ATR buffer */
+	CcidSlots[LunToReaderIndex(lun)].nATRLength = 0;
+	*CcidSlots[LunToReaderIndex(lun)].pcATRBuffer = '\0';
+
+	/* Reset PowerFlags */
+	CcidSlots[LunToReaderIndex(lun)].bPowerFlags = POWERFLAGS_RAZ;
 
 	return IFD_SUCCESS;
 } /* CardDown */