[Pcsclite-cvs-commit] r7105 - in trunk/Drivers/ccid: . MacOSX src
ludovic.rousseau at free.fr
ludovic.rousseau at free.fr
Tue Mar 24 12:03:56 UTC 2015
Author: rousseau
Date: 2015-03-24 12:03:53 +0000 (Tue, 24 Mar 2015)
New Revision: 7105
Modified:
trunk/Drivers/ccid/MacOSX/configure
trunk/Drivers/ccid/configure.ac
trunk/Drivers/ccid/src/debug.c
Log:
Re-enable syslog logging on Yosemite
The patch has been applied in revision 7092 and reverted in revision
7104.
This new version is a bit different.
- the priority parameter is used and reflect syslog priorities
- the ATR and APDU are not logged since it is not needed
Use: sudo syslog -c "com.apple.ifdreader PID" -d
to change the logging level.
See also "Change syslog logging level on Yosemite"
http://ludovicrousseau.blogspot.com/2015/03/change-syslog-logging-level-on-yosemite.html
Modified: trunk/Drivers/ccid/MacOSX/configure
===================================================================
--- trunk/Drivers/ccid/MacOSX/configure 2015-03-24 09:29:22 UTC (rev 7104)
+++ trunk/Drivers/ccid/MacOSX/configure 2015-03-24 12:03:53 UTC (rev 7105)
@@ -72,6 +72,13 @@
CONFIGURE_ARGS="--disable-dependency-tracking"
+# Are we on a CryptoTokenKit system? (like Mac OS X 10.10 Yosemite)
+if [ -d /System/Library/CryptoTokenKit ]
+then
+ # so we use syslog(3) to log errors
+ CONFIGURE_ARGS="$CONFIGURE_ARGS --enable-syslog"
+fi
+
# do not build a static driver
# (building fails when linking statically with libusb)
CONFIGURE_ARGS="$CONFIGURE_ARGS --disable-static"
Modified: trunk/Drivers/ccid/configure.ac
===================================================================
--- trunk/Drivers/ccid/configure.ac 2015-03-24 09:29:22 UTC (rev 7104)
+++ trunk/Drivers/ccid/configure.ac 2015-03-24 12:03:53 UTC (rev 7105)
@@ -238,6 +238,17 @@
AM_CONDITIONAL(WITHOUT_PCSC, test "${pcsclite}" != "yes")
+
+# --enable-syslog
+AC_ARG_ENABLE(syslog,
+ AS_HELP_STRING([--enable-syslog],[use syslog instead of printf for debug (Yosemite)]),
+ [ use_syslog="${enableval}" ], [ use_syslog=no ] )
+
+if test x$use_syslog = xyes; then
+ AC_DEFINE(USE_SYSLOG, 1, [Use syslog(3) for debug])
+fi
+
+
# --disable-class
AC_ARG_ENABLE(class,
AS_HELP_STRING([--disable-class],[remove the CCIDCLASSDRIVER from Info.plist]),
Modified: trunk/Drivers/ccid/src/debug.c
===================================================================
--- trunk/Drivers/ccid/src/debug.c 2015-03-24 09:29:22 UTC (rev 7104)
+++ trunk/Drivers/ccid/src/debug.c 2015-03-24 12:03:53 UTC (rev 7105)
@@ -32,6 +32,10 @@
#include <sys/time.h>
#include <stdlib.h>
+#ifdef USE_SYSLOG
+#include <syslog.h>
+#endif
+
#include "strlcpycat.h"
#undef LOG_TO_STDERR
@@ -50,6 +54,24 @@
struct timeval new_time = { 0, 0 };
struct timeval tmp;
int delta;
+#ifdef USE_SYSLOG
+ int syslog_level;
+
+ switch(priority)
+ {
+ case PCSC_LOG_CRITICAL:
+ syslog_level = LOG_CRIT;
+ break;
+ case PCSC_LOG_ERROR:
+ syslog_level = LOG_ERR;
+ break;
+ case PCSC_LOG_INFO:
+ syslog_level = LOG_INFO;
+ break;
+ default:
+ syslog_level = LOG_DEBUG;
+ }
+#else
const char *color_pfx = "", *color_sfx = "";
const char *time_pfx = "", *time_sfx = "";
static int initialized = 0;
@@ -105,6 +127,7 @@
break;
}
}
+#endif
gettimeofday(&new_time, NULL);
if (0 == last_time.tv_sec)
@@ -128,9 +151,13 @@
(void)vsnprintf(debug_buffer, sizeof debug_buffer, fmt, argptr);
va_end(argptr);
+#ifdef USE_SYSLOG
+ syslog(syslog_level, "%.8d %s", delta, debug_buffer);
+#else
(void)fprintf(LOG_STREAM, "%s%.8d%s %s%s%s\n", time_pfx, delta, time_sfx,
color_pfx, debug_buffer, color_sfx);
fflush(LOG_STREAM);
+#endif
} /* log_msg */
void log_xxd(const int priority, const char *msg, const unsigned char *buffer,
@@ -152,6 +179,10 @@
c += 3;
}
+#ifdef USE_SYSLOG
+ syslog(LOG_DEBUG, "%s", debug_buffer);
+#else
(void)fprintf(LOG_STREAM, "%s\n", debug_buffer);
fflush(LOG_STREAM);
+#endif
} /* log_xxd */
More information about the Pcsclite-cvs-commit
mailing list