diff --git a/src/agent.conf b/src/agent.conf index 204fdb8014ad2be68b87eb9f5d57c21177238aff..77ad02a4f46b794b2da8afb54f152bcad621dde9 100644 --- a/src/agent.conf +++ b/src/agent.conf @@ -1,5 +1,6 @@ config wifiagent option enabled '1' + option debug '6' config fh-iface option ifname 'wl0' diff --git a/src/core/config.c b/src/core/config.c index 7c8c314231e2855c32fa4df8bcf66e8f61e89293..afbdece4a941100fa4458c49cc4c63f720749e25 100644 --- a/src/core/config.c +++ b/src/core/config.c @@ -32,6 +32,8 @@ #include "worker.h" #include "agent.h" +int verbose; + static struct netif_bkcfg *get_netif_bkcfg_by_name(struct agent_config *c, const char *name) { @@ -508,10 +510,12 @@ static int cntlr_config_get_wifi_agent(struct agent_config *a, { enum { A_ENABLED, + A_DEBUG, NUM_POLICIES }; const struct uci_parse_option opts[] = { { .name = "enabled", .type = UCI_TYPE_STRING }, + { .name = "debug", .type = UCI_TYPE_STRING }, }; struct uci_option *tb[NUM_POLICIES]; @@ -520,6 +524,12 @@ static int cntlr_config_get_wifi_agent(struct agent_config *a, if (tb[A_ENABLED]) a->enabled = atoi(tb[A_ENABLED]->v.string) == 1 ? true : false; + if (tb[A_DEBUG]) { + a->debug_level = atoi(tb[A_DEBUG]->v.string); + if (verbose < a->debug_level) + verbose = a->debug_level; + } + return 0; } diff --git a/src/core/config.h b/src/core/config.h index 57eb959f52a85fe83f88ef111bd2ce5e747d02ee..bf9b53c77442ac9eda118741d02127f62c478280 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -102,6 +102,7 @@ enum runfreq { struct agent_config { bool enabled; + int debug_level; enum runfreq runfreq; struct list_head fhlist; /* list of netif_fhcfg */ struct list_head bklist; /* list of netif_bkcfg */