From 0bf42867ada896efbc83e18e697cc4b980f66e14 Mon Sep 17 00:00:00 2001 From: albfan Date: Sat, 22 Aug 2015 00:25:08 +0200 Subject: [PATCH] log wpa messages --- res/miraclecast-completion | 4 +++- src/shared/shl_log.h | 7 +++++++ src/shared/wpas.c | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/res/miraclecast-completion b/res/miraclecast-completion index f0835a9..bedb631 100755 --- a/res/miraclecast-completion +++ b/res/miraclecast-completion @@ -6,6 +6,8 @@ function _miracle-wifid() { case "$prev" in --log-level) + COMPREPLY=($(compgen -W '1 2 3 4 5 6 7 8' -- "$cur")) + --wpa-loglevel) COMPREPLY=($(compgen -W '1 2 3 4 5 6 7' -- "$cur")) return 0 ;; @@ -24,7 +26,7 @@ function _miracle-sinkctl() { case "$prev" in --log-level) - COMPREPLY=($(compgen -W '1 2 3 4 5 6 7' -- "$cur")) + COMPREPLY=($(compgen -W '1 2 3 4 5 6 7 8' -- "$cur")) return 0 ;; esac diff --git a/src/shared/shl_log.h b/src/shared/shl_log.h index ce660ce..5b49724 100644 --- a/src/shared/shl_log.h +++ b/src/shared/shl_log.h @@ -45,6 +45,9 @@ enum log_severity { #endif #ifndef LOG_DEBUG LOG_DEBUG = 7, +#endif +#ifndef LOG_TRACE + LOG_TRACE = 8, #endif LOG_SEV_NUM, }; @@ -167,9 +170,13 @@ extern const char *LOG_SUBSYSTEM; #ifdef BUILD_ENABLE_DEBUG #define log_debug(format, ...) \ log_printf(LOG_DEBUG, (format), ##__VA_ARGS__) + #define log_trace(format, ...) \ + log_printf(LOG_TRACE, (format), ##__VA_ARGS__) #else #define log_debug(format, ...) \ log_dummyf(LOG_DEBUG, (format), ##__VA_ARGS__) + #define log_trace(format, ...) \ + log_dummyf(LOG_TRACE, (format), ##__VA_ARGS__) #endif #define log_info(format, ...) \ diff --git a/src/shared/wpas.c b/src/shared/wpas.c index 8e14d43..4b2adea 100644 --- a/src/shared/wpas.c +++ b/src/shared/wpas.c @@ -17,6 +17,8 @@ * along with MiracleCast; If not, see . */ +#define LOG_SUBSYSTEM "wpa" + #include #include #include @@ -33,6 +35,7 @@ #include "shl_dlist.h" #include "shl_util.h" #include "wpas.h" +#include "shl_log.h" #define CTRL_PATH_TEMPLATE "/tmp/.miracle-wpas-%d-%lu" @@ -742,6 +745,8 @@ static int wpas__parse_message(struct wpas *w, int r, num; bool is_event = false; + log_trace("raw message: %s", raw); + if ((pos = shl_startswith(raw, "IFNAME="))) { ifname = pos; pos = strchrnul(pos, ' ');