[Pcsclite-cvs-commit] r2130 - trunk/Drivers/ccid/src

Ludovic Rousseau rousseau at costa.debian.org
Wed Aug 9 07:17:32 UTC 2006


Author: rousseau
Date: 2006-08-09 07:17:31 +0000 (Wed, 09 Aug 2006)
New Revision: 2130

Modified:
   trunk/Drivers/ccid/src/ifdhandler.c
Log:
IFDHCreateChannelByName(): add a "warm up" sequence. This 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


Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c	2006-08-09 07:16:11 UTC (rev 2129)
+++ trunk/Drivers/ccid/src/ifdhandler.c	2006-08-09 07:17:31 UTC (rev 2130)
@@ -99,9 +99,27 @@
 		ReleaseReaderIndex(reader_index);
 	}
 	else
+	{
 		/* Maybe we have a special treatment for this reader */
 		ccid_open_hack(reader_index);
 
+		/* 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 */
+		if ((IFD_COMMUNICATION_ERROR == IFDHICCPresence(Lun))
+			&& (IFD_COMMUNICATION_ERROR == IFDHICCPresence(Lun))
+			&& (IFD_COMMUNICATION_ERROR == IFDHICCPresence(Lun)))
+		{
+			DEBUG_CRITICAL("failed");
+			return_value = IFD_COMMUNICATION_ERROR;
+
+			/* release the allocated reader_index */
+			ReleaseReaderIndex(reader_index);
+		}
+	}
+
 #ifdef HAVE_PTHREAD
 	pthread_mutex_unlock(&ifdh_context_mutex);
 #endif




More information about the Pcsclite-cvs-commit mailing list