diff options
author | Chia-chi Yeh <chiachi@android.com> | 2009-08-06 11:16:47 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-06 11:16:47 -0700 |
commit | 11968dc74d8e3852d1dd8a8edf8283c40a6e62f1 (patch) | |
tree | 7d0d3e68e3203156df906a426ac8b7222e180a12 | |
parent | 1ef96f6c52661d5bc09aa443d2de09a2eff0e364 (diff) | |
parent | 5f0106824621dbd0c47169af8a1f3f6fbe27a837 (diff) | |
download | wpa_supplicant-11968dc74d8e3852d1dd8a8edf8283c40a6e62f1.tar.gz |
am 5f010682: wpa_supplicant: Remove unnecessary messages.
Merge commit '5f0106824621dbd0c47169af8a1f3f6fbe27a837'
* commit '5f0106824621dbd0c47169af8a1f3f6fbe27a837':
wpa_supplicant: Remove unnecessary messages.
-rw-r--r-- | .config | 2 | ||||
-rw-r--r-- | common.c | 42 | ||||
-rw-r--r-- | common.h | 22 |
3 files changed, 47 insertions, 19 deletions
@@ -33,5 +33,5 @@ CONFIG_DRIVER_WEXT=y # CONFIG_DRIVER_NDIS=y # CONFIG_DRIVER_TEST=y # CONFIG_DRIVER_CUSTOM=y -CONFIG_DEBUG_FILE=y +# CONFIG_DEBUG_FILE=y # CONFIG_INTERNAL_LIBTOMMATH=y @@ -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 @@ void wpa_get_ntp_timestamp(u8 *buf) 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 @@ void wpa_printf(int level, char *fmt, ...) #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 @@ void wpa_debug_close_file(void) #endif /* CONFIG_NO_STDOUT_DEBUG */ +#endif /* ANDROID */ #ifndef CONFIG_NO_WPA_MSG static wpa_msg_cb_func wpa_msg_cb = NULL; @@ -256,6 +256,27 @@ void wpa_get_ntp_timestamp(u8 *buf); 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 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, #endif /* CONFIG_NO_STDOUT_DEBUG */ +#endif /* ANDROID */ #ifdef CONFIG_NO_WPA_MSG #define wpa_msg(args...) do { } while (0) |