[Pcsclite-cvs-commit] Drivers/ccid/src ifdhandler.c,1.22,1.23
rousseau@haydn.debian.org
rousseau@haydn.debian.org
Update of /cvsroot/pcsclite/Drivers/ccid/src
In directory haydn:/tmp/cvs-serv24021/src
Modified Files:
ifdhandler.c
Log Message:
during the first IFDHCreateChannel*() init_debug() is called to read the
value of ifdLogLevel from the Info.plist
Index: ifdhandler.c
===================================================================
RCS file: /cvsroot/pcsclite/Drivers/ccid/src/ifdhandler.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- ifdhandler.c 6 Apr 2004 08:59:26 -0000 1.22
+++ ifdhandler.c 6 Apr 2004 13:14:02 -0000 1.23
@@ -17,10 +17,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id */
+/* $Id$ */
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "pcscdefines.h"
#include "defs.h"
@@ -33,6 +34,7 @@
#include "protocol_t1/atr.h"
#include "protocol_t1/pps.h"
#include "protocol_t1/protocol_t1.h"
+#include "parser.h"
#ifdef HAVE_PTHREAD
#include <pthread.h>
@@ -46,11 +48,19 @@
static pthread_mutex_t ifdh_context_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
+static int DebugInitialized = FALSE;
+int LogLevel = DEBUG_LEVEL_CRITICAL | DEBUG_LEVEL_INFO;
+
+static void init_debug(void);
+
RESPONSECODE IFDHCreateChannelByName(DWORD Lun, LPSTR lpcDevice)
{
RESPONSECODE return_value = IFD_SUCCESS;
+ if (! DebugInitialized)
+ init_debug();
+
DEBUG_INFO3("lun: %X, device: %s", Lun, lpcDevice);
if (CheckLun(Lun))
@@ -121,6 +131,9 @@
*/
RESPONSECODE return_value = IFD_SUCCESS;
+ if (! DebugInitialized)
+ init_debug();
+
DEBUG_INFO2("lun: %X", Lun);
if (CheckLun(Lun))
@@ -700,4 +713,27 @@
return IFD_SUCCESS;
} /* CardDown */
+
+
+void init_debug(void)
+{
+ char keyValue[TOKEN_MAX_VALUE_SIZE];
+ char infofile[FILENAME_MAX];
+
+ /* Info.plist full patch filename */
+ snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist",
+ PCSCLITE_HP_DROPDIR, BUNDLE);
+
+ if (LTPBundleFindValueWithKey(infofile, "ifdLogLevel", keyValue, 0))
+ return;
+
+ /* convert from hex or dec or octal */
+ LogLevel = strtoul(keyValue, 0, 16);
+
+ /* print the log level used */
+ debug_msg("%s:%d:%s LogLevel: 0x%.4X", __FILE__, __LINE__, __FUNCTION__,
+ LogLevel);
+
+ DebugInitialized = TRUE;
+} /* init_debug */