[Pcsclite-cvs-commit] CVS Drivers/ccid/src
CVS User rousseau
ludovic.rousseau@free.fr
Mon, 02 May 2005 11:36:08 +0000
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv11550
Modified Files:
commands.c
Log Message:
CmdEscape(): replay the command if we receive STATUS_COMM_NAK
--- /cvsroot/pcsclite/Drivers/ccid/src/commands.c 2005/03/14 18:56:51 1.38
+++ /cvsroot/pcsclite/Drivers/ccid/src/commands.c 2005/05/02 11:36:08 1.39
@@ -18,7 +18,7 @@
*/
/*
- * $Id: commands.c,v 1.38 2005/03/14 18:56:51 rousseau Exp $
+ * $Id: commands.c,v 1.39 2005/05/02 11:36:08 rousseau Exp $
*/
#include <string.h>
@@ -220,6 +220,7 @@
RESPONSECODE return_value = IFD_SUCCESS;
_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
+again:
/* allocate buffers */
length_in = 10 + TxLength;
if (NULL == (cmd_in = malloc(length_in)))
@@ -250,6 +251,17 @@
}
res = ReadPort(reader_index, &length_out, cmd_out);
+
+ /* replay the command if NAK
+ * This (generally) happens only for the first command sent to the reader
+ * with the serial protocol so it is not really needed for all the other
+ * ReadPort() calls */
+ if (STATUS_COMM_NAK == res)
+ {
+ free(cmd_out);
+ goto again;
+ }
+
if (res != STATUS_SUCCESS)
{
free(cmd_out);