[Pcsclite-cvs-commit] r5330 - /trunk/Drivers/ccid/src/ifdhandler.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Oct 21 18:54:30 UTC 2010


Author: rousseau
Date: Thu Oct 21 18:54:26 2010
New Revision: 5330

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5330
Log:
Use TAG_IFD_POLLING_THREAD_WITH_TIMEOUT instead of
TAG_IFD_POLLING_THREAD to support the auto power off feature introduced
in pcsc-lite revision 5328

Modified:
    trunk/Drivers/ccid/src/ifdhandler.c

Modified: trunk/Drivers/ccid/src/ifdhandler.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/ifdhandler.c?rev=5330&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Thu Oct 21 18:54:26 2010
@@ -318,7 +318,7 @@
 
 
 #if !defined(TWIN_SERIAL)
-static RESPONSECODE IFDHPolling(DWORD Lun)
+static RESPONSECODE IFDHPolling(DWORD Lun, int timeout)
 {
 	int reader_index;
 
@@ -327,21 +327,23 @@
 
 	/* log only if DEBUG_LEVEL_PERIODIC is set */
 	if (LogLevel & DEBUG_LEVEL_PERIODIC)
-		DEBUG_INFO3("%s (lun: %X)", CcidSlots[reader_index].readerName, Lun);
-
-	return InterruptRead(reader_index, 60*60*1000);	/* 1 hour */
+		DEBUG_INFO4("%s (lun: %X) %d ms", CcidSlots[reader_index].readerName,
+			Lun, timeout);
+
+	return InterruptRead(reader_index, timeout);
 }
 
 /* on an ICCD device the card is always inserted
  * so no card movement will ever happen: just do nothing */
-static RESPONSECODE IFDHSleep(DWORD Lun)
+static RESPONSECODE IFDHSleep(DWORD Lun, int timeout)
 {
 	int reader_index;
 
 	if (-1 == (reader_index = LunToReaderIndex(Lun)))
 		return IFD_COMMUNICATION_ERROR;
 
-	DEBUG_INFO3("%s (lun: %X)", CcidSlots[reader_index].readerName, Lun);
+	DEBUG_INFO4("%s (lun: %X) %d ms", CcidSlots[reader_index].readerName, Lun,
+		timeout);
 
 	/* just sleep for 5 seconds since the polling thread is NOT killable
 	 * so pcscd event thread must loop to exit cleanly
@@ -350,7 +352,7 @@
 	 * TAG_IFD_POLLING_THREAD_KILLABLE then we could use a much longer delay
 	 * and be killed before pcscd exits
 	 */
-	(void)sleep(600);	/* 10 minutes */
+	(void)usleep(timeout);
 	return IFD_SUCCESS;
 }
 
@@ -528,7 +530,7 @@
 			break;
 
 #if !defined(TWIN_SERIAL)
-		case TAG_IFD_POLLING_THREAD:
+		case TAG_IFD_POLLING_THREAD_WITH_TIMEOUT:
 			{
 				_ccid_descriptor *ccid_desc;
 




More information about the Pcsclite-cvs-commit mailing list