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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Aug 2 13:40:34 UTC 2012


Author: rousseau
Date: Thu Aug  2 13:40:34 2012
New Revision: 6396

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6396
Log:
CreateChannelByNameOrChannel(): Do not change the default timeout for
the first call to CmdGetSlotStatus().

In revision 4938 the timeout is changed from default to 100 ms to avoid
a 2 seconds delay if the reader needs to resynchronize.

In revision 5389 the timeout was changed from 100 ms to 1000 ms because
it was too sort for the Kobil KAAN Base reader.

The idea now is to use the default value (DEFAULT_COM_READ_TIMEOUT
(3*1000)) for the first CmdGetSlotStatus() call. And then use a short
value (100 ms) for the 2 next calls.

The reader should have enough time to start during the 3 first seconds.

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=6396&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Thu Aug  2 13:40:34 2012
@@ -131,19 +131,22 @@
 		/* Maybe we have a special treatment for this reader */
 		(void)ccid_open_hack_pre(reader_index);
 
-		/* save the current read timeout computed from card capabilities */
-		oldReadTimeout = ccid_descriptor->readTimeout;
-
-		/* 1000ms just to resync the USB toggle bits */
-		ccid_descriptor->readTimeout = 1000;
-
 		/* Try to access the reader */
 		/* This "warm up" sequence is sometimes needed when pcscd is
 		 * restarted with the reader already connected. We get some
 		 * "usb_bulk_read: Resource temporarily unavailable" on the first
 		 * few tries. It is an empirical hack */
+
+		/* The reader may have to start here so give it some time */
+		CmdGetSlotStatus(reader_index, pcbuffer);
+
+		/* save the current read timeout computed from card capabilities */
+		oldReadTimeout = ccid_descriptor->readTimeout;
+
+		/* 100 ms just to resync the USB toggle bits */
+		ccid_descriptor->readTimeout = 100;
+
 		if ((IFD_COMMUNICATION_ERROR == CmdGetSlotStatus(reader_index, pcbuffer))
-			&& (IFD_COMMUNICATION_ERROR == CmdGetSlotStatus(reader_index, pcbuffer))
 			&& (IFD_COMMUNICATION_ERROR == CmdGetSlotStatus(reader_index, pcbuffer)))
 		{
 			DEBUG_CRITICAL("failed");




More information about the Pcsclite-cvs-commit mailing list