[Pcsclite-cvs-commit] CVS Drivers/ccid/src/openct
CVS User rousseau
ludovic.rousseau@free.fr
Tue, 19 Oct 2004 01:22:07 -0600
Update of /cvsroot/pcsclite/Drivers/ccid/src/openct
In directory haydn:/tmp/cvs-serv9364/openct
Modified Files:
proto-t1.c
Log Message:
Add support of character level communication (CCID_CLASS_CHARACTER).
Thanks to Jeffrey Dai
--- /cvsroot/pcsclite/Drivers/ccid/src/openct/proto-t1.c 2004/08/24 07:32:27 1.15
+++ /cvsroot/pcsclite/Drivers/ccid/src/openct/proto-t1.c 2004/10/19 07:22:07 1.16
@@ -656,20 +656,53 @@
DEBUG_XXD("sending: ", block, slen);
- n = CCID_Transmit(t1 -> lun, slen, block, t1->wtx);
- t1->wtx = 0; /* reset to default value */
- if (n != IFD_SUCCESS)
- return n;
-
- /* Get the response en bloc */
- n = CCID_Receive(t1 -> lun, &rmax, block);
- if (n == IFD_PARITY_ERROR)
- return -2;
- if (n != IFD_SUCCESS)
- return -1;
+ if (isCharLevel(t1->lun))
+ {
+ rmax = 3;
+
+ n = CCID_Transmit(t1 -> lun, slen, block, rmax, t1->wtx);
+ if (n != IFD_SUCCESS)
+ return n;
+
+ n = CCID_Receive(t1 -> lun, &rmax, block);
+ if (n == IFD_PARITY_ERROR)
+ return -2;
+ if (n != IFD_SUCCESS)
+ return -1;
+
+ rmax = block[2] + 1;
+
+ n = CCID_Transmit(t1 -> lun, 0, block, rmax, t1->wtx);
+ if (n != IFD_SUCCESS)
+ return n;
+
+ n = CCID_Receive(t1 -> lun, &rmax, &block[3]);
+ if (n == IFD_PARITY_ERROR)
+ return -2;
+ if (n != IFD_SUCCESS)
+ return -1;
+
+ n = rmax + 3;
+ }
+ else
+ {
+ n = CCID_Transmit(t1 -> lun, slen, block, 0, t1->wtx);
+ t1->wtx = 0; /* reset to default value */
+ if (n != IFD_SUCCESS)
+ return n;
+
+ /* Get the response en bloc */
+ n = CCID_Receive(t1 -> lun, &rmax, block);
+ if (n == IFD_PARITY_ERROR)
+ return -2;
+ if (n != IFD_SUCCESS)
+ return -1;
- n = rmax;
- if (n >= 0) {
+ n = rmax;
+ }
+
+ if (n >= 0)
+ {
m = block[2] + 3 + t1->rc_bytes;
if (m < n)
n = m;