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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Mar 27 16:14:00 UTC 2009


Author: rousseau
Date: Fri Mar 27 16:13:59 2009
New Revision: 3395

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3395
Log:
IFDHCreateChannel(): use the same empirical hack as in
IFDHCreateChannelByName() to recover the reader after pcscd is
restarted.

The problem is that USB frames have a toggle bit

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=3395&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c (original)
+++ trunk/Drivers/ccid/src/ifdhandler.c Fri Mar 27 16:13:59 2009
@@ -205,8 +205,27 @@
 		ReleaseReaderIndex(reader_index);
 	}
 	else
+	{
+		/* 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 resources */
+			(void)ClosePort(reader_index);
+			ReleaseReaderIndex(reader_index);
+		}
+
 		/* Maybe we have a special treatment for this reader */
 		(void)ccid_open_hack(reader_index);
+	}
 
 #ifdef HAVE_PTHREAD
 	(void)pthread_mutex_unlock(&ifdh_context_mutex);




More information about the Pcsclite-cvs-commit mailing list