summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2011-11-09 11:47:44 +0000
committerGabor Juhos <juhosg@openwrt.org>2011-11-09 11:47:44 +0000
commitb1a4acfb407d6d116689538faa74c84db4f22901 (patch)
tree40c647cfced6d9b5a56701605b049340a052cb17
parent10f199d832eeae9768b327fd227c88de108106cf (diff)
downloadmtk-20170518-b1a4acfb407d6d116689538faa74c84db4f22901.zip
mtk-20170518-b1a4acfb407d6d116689538faa74c84db4f22901.tar.gz
mtk-20170518-b1a4acfb407d6d116689538faa74c84db4f22901.tar.bz2
pacakge/iw: don't show a stray ']' if the chain signal attribute list is empty
Without the patch, the output of 'station dump' command looks weird in some cases: root@OpenWrt:/# iw dev wlan0 station dump Station 00:21:27:cb:57:02 (on wlan0) inactive time: 190 ms rx bytes: 36652 rx packets: 149 tx bytes: 1998 tx packets: 16 tx retries: 0 tx failed: 0 signal: -31 ] dBm signal avg: -30 [-32, -36] dBm tx bitrate: 5.5 MBit/s rx bitrate: 54.0 MBit/s root@OpenWrt:/# SVN-Revision: 28879
-rw-r--r--package/iw/Makefile2
-rw-r--r--package/iw/patches/120-per_chain_signal_strength.patch10
2 files changed, 7 insertions, 5 deletions
diff --git a/package/iw/Makefile b/package/iw/Makefile
index c0f6eb7..159d69a 100644
--- a/package/iw/Makefile
+++ b/package/iw/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=iw
PKG_VERSION:=3.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=http://wireless.kernel.org/download/iw/
diff --git a/package/iw/patches/120-per_chain_signal_strength.patch b/package/iw/patches/120-per_chain_signal_strength.patch
index abdd638..411b51e 100644
--- a/package/iw/patches/120-per_chain_signal_strength.patch
+++ b/package/iw/patches/120-per_chain_signal_strength.patch
@@ -1,6 +1,6 @@
--- a/station.c
+++ b/station.c
-@@ -61,6 +61,31 @@ static void print_sta_bitrate(struct nla
+@@ -61,6 +61,33 @@ static void print_sta_bitrate(struct nla
}
}
@@ -24,7 +24,9 @@
+ cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix,
+ (int8_t) nla_get_u8(attr));
+ }
-+ snprintf(cur, sizeof(buf) - (cur - buf), "] ");
++
++ if (i)
++ snprintf(cur, sizeof(buf) - (cur - buf), "] ");
+
+ return buf;
+}
@@ -32,7 +34,7 @@
static int print_sta_handler(struct nl_msg *msg, void *arg)
{
struct nlattr *tb[NL80211_ATTR_MAX + 1];
-@@ -81,7 +106,10 @@ static int print_sta_handler(struct nl_m
+@@ -81,7 +108,10 @@ static int print_sta_handler(struct nl_m
[NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
[NL80211_STA_INFO_TX_RETRIES] = { .type = NLA_U32 },
[NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
@@ -43,7 +45,7 @@
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
-@@ -128,12 +156,18 @@ static int print_sta_handler(struct nl_m
+@@ -128,12 +158,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]));