[PATCH 2/2] iw: print firmware and hardware version
From: Kalle Valo <hidden>
Date: 2009-09-24 18:09:35
Subsystem:
the rest · Maintainer:
Linus Torvalds
struct wiphy now contains firmware and hardware version, print that information to the user. --- info.c | 15 +++++++++++++++ nl80211.h | 3 +++ 2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/info.c b/info.c
index 7bca69d..ae3ed54 100644
--- a/info.c
+++ b/info.c@@ -66,6 +66,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) struct nlattr *nl_freq; struct nlattr *nl_rate; struct nlattr *nl_mode; + const char *str; int bandidx = 1; int rem_band, rem_freq, rem_rate, rem_mode; int open;
@@ -263,6 +264,20 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) printf("\tRTS threshold: %d\n", rts); } + if (tb_msg[NL80211_ATTR_FW_VERSION]) { + str = nla_get_string(tb_msg[NL80211_ATTR_FW_VERSION]); + if (strlen(str) == 0) + str = "<unknown>"; + printf("\tFirmware version: %s\n", str); + } + + if (tb_msg[NL80211_ATTR_HW_VERSION]) { + str = nla_get_string(tb_msg[NL80211_ATTR_HW_VERSION]); + if (strlen(str) == 0) + str = "<unknown>"; + printf("\tHardware version: %s\n", str); + } + if (!tb_msg[NL80211_ATTR_SUPPORTED_IFTYPES]) return NL_SKIP;
diff --git a/nl80211.h b/nl80211.h
index a8d71ed..6d6651f 100644
--- a/nl80211.h
+++ b/nl80211.h@@ -714,6 +714,9 @@ enum nl80211_attrs { NL80211_ATTR_PID, + NL80211_ATTR_FW_VERSION, + NL80211_ATTR_HW_VERSION, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,