[Pcsclite-git-commit] [CCID] 01/02: CreateChannel: allow to use a non default timeout

Ludovic Rousseau rousseau at moszumanska.debian.org
Wed May 4 16:34:37 UTC 2016


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository CCID.

commit 1e3c6c14683e3b5a9bc27fed55ae32b7dc2ee157
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Wed May 4 18:20:13 2016 +0200

    CreateChannel: allow to use a non default timeout
    
    By default the read timeout is set to 100 ms for the double call of
    CmdGetSlotStatus() in CreateChannelByNameOrChannel() use to resync the
    USB toggle bits.
    This is a short delay so that a failing reader will not block for too
    long. The defaut timeout value is 3 seconds so a total of 6 seconds
    would be lost is the reader is not responding.
    
    Unfortunately some readers (in particular contactless readers) are very
    long to anwser to the PC_to_RDR_GetSlotStatus CCID command. I guess it
    is to be sure no contactless card is present in the field.
    
    It is now possible to change the 100 ms timeout to something else for a
    specific reader by adding code in ccid_open_hack_pre() and
    ccid_open_hack_post().
---
 src/ifdhandler.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/ifdhandler.c b/src/ifdhandler.c
index 1ab367a..207157e 100644
--- a/src/ifdhandler.c
+++ b/src/ifdhandler.c
@@ -177,7 +177,10 @@ static RESPONSECODE CreateChannelByNameOrChannel(DWORD Lun,
 		oldReadTimeout = ccid_descriptor->readTimeout;
 
 		/* 100 ms just to resync the USB toggle bits */
-		ccid_descriptor->readTimeout = 100;
+		/* Do not use a fixed 100 ms value but compute it from the
+		 * default timeout. It is now possible to use a different value
+		 * by changing readTimeout in ccid_open_hack_pre() */
+		ccid_descriptor->readTimeout = ccid_descriptor->readTimeout * 100.0 / DEFAULT_COM_READ_TIMEOUT;
 
 		if ((IFD_COMMUNICATION_ERROR == CmdGetSlotStatus(reader_index, pcbuffer))
 			&& (IFD_COMMUNICATION_ERROR == CmdGetSlotStatus(reader_index, pcbuffer)))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/CCID.git



More information about the Pcsclite-cvs-commit mailing list