All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw: display DFS regulatory domain
@ 2013-04-03 12:51 Zefir Kurtisi
  2013-04-03 13:07 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Zefir Kurtisi @ 2013-04-03 12:51 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Zefir Kurtisi

Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
---
 reg.c |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/reg.c b/reg.c
index 5afc92b..9a60cec 100644
--- a/reg.c
+++ b/reg.c
@@ -59,6 +59,22 @@ char *reg_initiator_to_string(__u8 initiator)
 	}
 }
 
+static const char *dfs_domain_name(enum nl80211_dfs_regions region)
+{
+	switch (region) {
+	case NL80211_DFS_UNSET:
+		return "DFS-UNSET";
+	case NL80211_DFS_FCC:
+		return "DFS-FCC";
+	case NL80211_DFS_ETSI:
+		return "DFS-ETSI";
+	case NL80211_DFS_JP:
+		return "DFS-JP";
+	default:
+		return "DFS-invalid";
+	}
+}
+
 static int handle_reg_set(struct nl80211_state *state,
 			  struct nl_cb *cb,
 			  struct nl_msg *msg,
@@ -110,6 +126,7 @@ static int print_reg_handler(struct nl_msg *msg, void *arg)
 	char *alpha2;
 	struct nlattr *nl_rule;
 	int rem_rule;
+	enum nl80211_dfs_regions dfs_domain;
 	static struct nla_policy reg_rule_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
 		[NL80211_ATTR_REG_RULE_FLAGS]		= { .type = NLA_U32 },
 		[NL80211_ATTR_FREQ_RANGE_START]		= { .type = NLA_U32 },
@@ -132,8 +149,13 @@ static int print_reg_handler(struct nl_msg *msg, void *arg)
 		return NL_SKIP;
 	}
 
+	if (tb_msg[NL80211_ATTR_DFS_REGION])
+		dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
+	else
+		dfs_domain = NL80211_DFS_UNSET;
+
 	alpha2 = nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]);
-	printf("country %c%c:\n", alpha2[0], alpha2[1]);
+	printf("country %c%c: %s\n", alpha2[0], alpha2[1], dfs_domain_name(dfs_domain));
 
 	nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule) {
 		struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iw: display DFS regulatory domain
  2013-04-03 12:51 [PATCH] iw: display DFS regulatory domain Zefir Kurtisi
@ 2013-04-03 13:07 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2013-04-03 13:07 UTC (permalink / raw)
  To: Zefir Kurtisi; +Cc: linux-wireless

Applied.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-03 13:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-03 12:51 [PATCH] iw: display DFS regulatory domain Zefir Kurtisi
2013-04-03 13:07 ` Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.