[Pcsclite-cvs-commit] CVS Drivers/ccid/src/openct
CVS User rousseau
ludovic.rousseau@free.fr
Tue, 26 Apr 2005 14:35:52 +0000
Update of /cvsroot/pcsclite/Drivers/ccid/src/openct
In directory haydn:/tmp/cvs-serv15143/openct
Modified Files:
proto-t1.c
Log Message:
t1_xcv(): increase the read timeout if the card sends and WTX request
--- /cvsroot/pcsclite/Drivers/ccid/src/openct/proto-t1.c 2004/10/19 07:22:07 1.16
+++ /cvsroot/pcsclite/Drivers/ccid/src/openct/proto-t1.c 2005/04/26 14:35:50 1.17
@@ -15,6 +15,8 @@
#include "proto-t1.h"
#include "checksum.h"
+#include "ccid.h"
+
#include <sys/poll.h>
#include <unistd.h>
#include <stdlib.h>
@@ -653,8 +655,21 @@
t1_xcv(t1_state_t *t1, unsigned char *block, size_t slen, size_t rmax)
{
int n, m;
+ _ccid_descriptor *ccid_desc ;
+ int oldReadTimeout;
DEBUG_XXD("sending: ", block, slen);
+
+ ccid_desc = get_ccid_descriptor(t1->lun);
+ oldReadTimeout = ccid_desc->readTimeout;
+
+ if (t1->wtx > 1)
+ {
+ /* set the new temporary timeout at WTX card request */
+ ccid_desc->readTimeout *= t1->wtx;
+ DEBUG_INFO2("New timeout at WTX request: %d sec",
+ ccid_desc->readTimeout);
+ }
if (isCharLevel(t1->lun))
{
@@ -711,6 +726,9 @@
if (n >= 0)
DEBUG_XXD("received: ", block, n);
+ /* Restore initial timeout */
+ ccid_desc->readTimeout = oldReadTimeout;
+
return n;
}