diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-02-07 11:28:21 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-02-07 11:28:21 +0000 |
commit | f56cc9dc127e0ea3f10aed64fbbfcbad02b78efb (patch) | |
tree | 74be17d7f9362374712fc0cb3e0c6d0fb4d66e03 /package/iw/patches/110-per_chain_signal_strength.patch | |
parent | 2119054b0a501a065a656f106d3fec11f0c854d3 (diff) | |
download | upstream-f56cc9dc127e0ea3f10aed64fbbfcbad02b78efb.tar.gz upstream-f56cc9dc127e0ea3f10aed64fbbfcbad02b78efb.tar.bz2 upstream-f56cc9dc127e0ea3f10aed64fbbfcbad02b78efb.zip |
iw: update to version 3.3, sync with latest nl80211.h changes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30347 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iw/patches/110-per_chain_signal_strength.patch')
-rw-r--r-- | package/iw/patches/110-per_chain_signal_strength.patch | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/package/iw/patches/110-per_chain_signal_strength.patch b/package/iw/patches/110-per_chain_signal_strength.patch new file mode 100644 index 0000000000..0bc5607921 --- /dev/null +++ b/package/iw/patches/110-per_chain_signal_strength.patch @@ -0,0 +1,70 @@ +--- a/station.c ++++ b/station.c +@@ -61,6 +61,33 @@ static void print_sta_bitrate(struct nla + } + } + ++static char *get_chain_signal(struct nlattr *attr_list) ++{ ++ struct nlattr *attr; ++ static char buf[64]; ++ char *cur = buf; ++ int i = 0, rem; ++ const char *prefix; ++ ++ if (!attr_list) ++ return ""; ++ ++ nla_for_each_nested(attr, attr_list, rem) { ++ if (i++ > 0) ++ prefix = ", "; ++ else ++ prefix = "["; ++ ++ cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix, ++ (int8_t) nla_get_u8(attr)); ++ } ++ ++ if (i) ++ snprintf(cur, sizeof(buf) - (cur - buf), "] "); ++ ++ return buf; ++} ++ + static int print_sta_handler(struct nl_msg *msg, void *arg) + { + struct nlattr *tb[NL80211_ATTR_MAX + 1]; +@@ -84,7 +111,10 @@ static int print_sta_handler(struct nl_m + [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 }, + [NL80211_STA_INFO_STA_FLAGS] = + { .minlen = sizeof(struct nl80211_sta_flag_update) }, ++ [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED }, ++ [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED }, + }; ++ char *chain; + + nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), + genlmsg_attrlen(gnlh, 0), NULL); +@@ -131,12 +161,18 @@ static int print_sta_handler(struct nl_m + if (sinfo[NL80211_STA_INFO_TX_FAILED]) + printf("\n\ttx failed:\t%u", + nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED])); ++ ++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]); + if (sinfo[NL80211_STA_INFO_SIGNAL]) +- printf("\n\tsignal: \t%d dBm", +- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL])); ++ printf("\n\tsignal: \t%d %sdBm", ++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]), ++ chain); ++ ++ chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]); + if (sinfo[NL80211_STA_INFO_SIGNAL_AVG]) +- printf("\n\tsignal avg:\t%d dBm", +- (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG])); ++ printf("\n\tsignal avg:\t%d %sdBm", ++ (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]), ++ chain); + + print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate"); + print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate"); |