[Pcsclite-cvs-commit] PCSC/src winscard.c,1.19,1.20
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/PCSC/src
In directory haydn:/tmp/cvs-serv23792
Modified Files:
winscard.c
Log Message:
really reset the card when asked to in SCardReconnect()
Index: winscard.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/winscard.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- winscard.c 18 Oct 2003 17:19:36 -0000 1.19
+++ winscard.c 19 Mar 2004 10:24:46 -0000 1.20
@@ -209,6 +209,9 @@
{
memcpy(pucAtr, rContext->ucAtr, rContext->dwAtrLen);
dwAtrLength = rContext->dwAtrLen;
+ if (rContext->dwAtrLen > 0)
+ DebugXxd("EHSpawnEventHandler: Card ATR: ",
+ rContext->ucAtr, rContext->dwAtrLen);
rContext->dwProtocol =
PHGetDefaultProtocol(pucAtr, dwAtrLength);
@@ -315,7 +318,16 @@
UCHAR pucAtr[MAX_ATR_SIZE], ucAvailable;
DWORD dwAtrLength, dwAction = 0;
- DebugLogA("SCardReconnect: Attempting reconnect to token.");
+ DebugLogA("SCardReconnect: Attempting reconnect to token.");
+
+ /*
+ * Zero out everything
+ */
+ rv = 0;
+ rContext = 0;
+ ucAvailable = 0;
+ dwAtrLength = 0;
+ memset(pucAtr, 0x00, MAX_ATR_SIZE);
if (hCard == 0)
return SCARD_E_INVALID_HANDLE;
@@ -392,6 +404,13 @@
dwInitialization == SCARD_UNPOWER_CARD)
{
/*
+ * Currently pcsc-lite keeps the card powered constantly
+ */
+ rv = IFDPowerICC(rContext, dwAction, rContext->ucAtr,
+ &rContext->dwAtrLen);
+
+ /*
+ * Notify the card has been reset
* Not doing this could result in deadlock
*/
rv = RFCheckReaderEventState(rContext, hCard);
@@ -416,9 +435,6 @@
return SCARD_F_INTERNAL_ERROR;
case SCARD_S_SUCCESS:
- rv = IFDPowerICC(rContext, dwAction, rContext->ucAtr,
- &rContext->dwAtrLen);
-
/*
* Notify the card has been reset
*/
@@ -451,7 +467,11 @@
}
if (rContext->dwAtrLen > 0)
+ {
DebugLogA("SCardReconnect: Reset complete.");
+ DebugXxd("SCardReconnect: Card ATR: ",
+ rContext->ucAtr, rContext->dwAtrLen);
+ }
else
DebugLogA("SCardReconnect: Error resetting card.");
break;