[Pcsclite-cvs-commit] r5490 - /trunk/PCSC/src/winscard.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Jan 6 09:49:04 UTC 2011


Author: rousseau
Date: Thu Jan  6 09:49:03 2011
New Revision: 5490

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5490
Log:
SCardDisconnect(): Switch to POWER_STATE_GRACE_PERIOD unless the card was not
powered

In the previous implementation the state was changed to
POWER_STATE_GRACE_PERIOD only if the previous state was
POWER_STATE_INUSE. So if a SCARD_SHARE_DIRECT connection was used the
card state was not set POWER_STATE_INUSE and a power off action was
immediate at the SCardDisconnect(). Not nice if the card is reused just
after.

Modified:
    trunk/PCSC/src/winscard.c

Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=5490&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Thu Jan  6 09:49:03 2011
@@ -963,7 +963,9 @@
 		DWORD dwGetSize;
 
 		(void)pthread_mutex_lock(&rContext->powerState_lock);
-		if (POWER_STATE_INUSE == rContext->powerState)
+		/* Switch to POWER_STATE_GRACE_PERIOD unless the card was not
+		 * powered */
+		if (POWER_STATE_POWERED <= rContext->powerState)
 		{
 #ifdef DISABLE_AUTO_POWER_ON
 			if (SCARD_RESET_CARD == dwDisposition)
@@ -976,6 +978,7 @@
 			Log1(PCSC_LOG_DEBUG, "powerState: POWER_STATE_GRACE_PERIOD");
 #endif
 		}
+
 		(void)pthread_mutex_unlock(&rContext->powerState_lock);
 
 		/* ask to stop the "polling" thread so it can be restarted using




More information about the Pcsclite-cvs-commit mailing list