merge from donut
diff --git a/.config b/.config
index 6b71f9c..b57e78f 100644
--- a/.config
+++ b/.config
@@ -33,5 +33,5 @@
# CONFIG_DRIVER_NDIS=y
# CONFIG_DRIVER_TEST=y
# CONFIG_DRIVER_CUSTOM=y
-CONFIG_DEBUG_FILE=y
+# CONFIG_DEBUG_FILE=y
# CONFIG_INTERNAL_LIBTOMMATH=y
diff --git a/common.c b/common.c
index 5f0f0a2..fce9254 100644
--- a/common.c
+++ b/common.c
@@ -16,10 +16,6 @@
#include "common.h"
-#ifdef ANDROID
-#include <cutils/log.h>
-#endif
-
#ifdef CONFIG_DEBUG_FILE
static FILE *out_file = NULL;
@@ -144,7 +140,30 @@
os_memcpy(buf + 4, (u8 *) &usec, 4);
}
+#ifdef ANDROID
+#include <android/log.h>
+
+void android_printf(int level, char *format, ...)
+{
+ if (level >= wpa_debug_level) {
+ va_list ap;
+ if (level == MSG_ERROR) {
+ level = ANDROID_LOG_ERROR;
+ } else if (level == MSG_WARNING) {
+ level = ANDROID_LOG_WARN;
+ } else if (level == MSG_INFO) {
+ level = ANDROID_LOG_INFO;
+ } else {
+ level = ANDROID_LOG_DEBUG;
+ }
+ va_start(ap, format);
+ __android_log_vprint(level, "wpa_supplicant", format, ap);
+ va_end(ap);
+ }
+}
+
+#else /* ANDROID */
#ifndef CONFIG_NO_STDOUT_DEBUG
@@ -195,20 +214,6 @@
#ifdef CONFIG_DEBUG_FILE
}
#endif /* CONFIG_DEBUG_FILE */
-#ifdef ANDROID
- if (level == MSG_DEBUG)
- level = ANDROID_LOG_DEBUG;
- else if (level == MSG_INFO)
- level = ANDROID_LOG_INFO;
- else if (level == MSG_WARNING)
- level = ANDROID_LOG_WARN;
- else if (level == MSG_ERROR)
- level = ANDROID_LOG_ERROR;
- else
- level = ANDROID_LOG_DEBUG;
-
- LOG_PRI_VA(level, "wpa_supplicant", fmt, ap);
-#endif
}
va_end(ap);
}
@@ -392,6 +397,7 @@
#endif /* CONFIG_NO_STDOUT_DEBUG */
+#endif /* ANDROID */
#ifndef CONFIG_NO_WPA_MSG
static wpa_msg_cb_func wpa_msg_cb = NULL;
diff --git a/common.h b/common.h
index 89121a7..8c560bc 100644
--- a/common.h
+++ b/common.h
@@ -256,6 +256,27 @@
enum { MSG_MSGDUMP, MSG_DEBUG, MSG_INFO, MSG_WARNING, MSG_ERROR };
+#ifdef ANDROID
+
+#define wpa_debug_print_timestamp() do {} while (0)
+#define wpa_hexdump(...) do {} while (0)
+#define wpa_hexdump_key(...) do {} while (0)
+#define wpa_hexdump_ascii(...) do {} while (0)
+#define wpa_hexdump_ascii_key(...) do {} while (0)
+#define wpa_debug_open_file(...) do {} while (0)
+#define wpa_debug_close_file() do {} while (0)
+
+void android_printf(int level, char *format, ...);
+
+#define wpa_printf(level, ...) \
+ do { \
+ if ((level) >= MSG_INFO) { \
+ android_printf((level), __VA_ARGS__); \
+ } \
+ } while (0)
+
+#else /* ANDROID */
+
#ifdef CONFIG_NO_STDOUT_DEBUG
#define wpa_debug_print_timestamp() do { } while (0)
@@ -358,6 +379,7 @@
#endif /* CONFIG_NO_STDOUT_DEBUG */
+#endif /* ANDROID */
#ifdef CONFIG_NO_WPA_MSG
#define wpa_msg(args...) do { } while (0)