[Pcsclite-cvs-commit] r2122 - trunk/Drivers/ccid/src
Ludovic Rousseau
rousseau at costa.debian.org
Thu Aug 3 13:14:27 UTC 2006
Author: rousseau
Date: 2006-08-03 13:14:27 +0000 (Thu, 03 Aug 2006)
New Revision: 2122
Modified:
trunk/Drivers/ccid/src/ifdhandler.c
Log:
IFDHICCPresence(): check the value returned by CmdEscape() in the
SCR331-DI contactless reader familly code.
Byg detected by using __attribute__((warn_unused_result)) also used as
__must_check by the Linux kernel
Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c 2006-08-03 13:12:20 UTC (rev 2121)
+++ trunk/Drivers/ccid/src/ifdhandler.c 2006-08-03 13:14:27 UTC (rev 2122)
@@ -1098,17 +1098,25 @@
unsigned char res[10];
unsigned int length_res = sizeof(res);
+ RESPONSECODE ret;
/* if DEBUG_LEVEL_PERIODIC is not set we remove DEBUG_LEVEL_COMM */
oldLogLevel = LogLevel;
if (! (LogLevel & DEBUG_LEVEL_PERIODIC))
LogLevel &= ~DEBUG_LEVEL_COMM;
- CmdEscape(reader_index, cmd, sizeof(cmd), res, &length_res);
+ ret = CmdEscape(reader_index, cmd, sizeof(cmd), res, &length_res);
/* set back the old LogLevel */
LogLevel = oldLogLevel;
+ if (ret != IFD_SUCCESS)
+ {
+ DEBUG_INFO("CmdEscape failed");
+ /* simulate a card absent */
+ res[0] = 0;
+ }
+
if (0x01 == res[0])
return_value = IFD_ICC_PRESENT;
else
More information about the Pcsclite-cvs-commit
mailing list