diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-22 13:39:16 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-02-22 13:39:16 +0000 |
commit | 64cc700dccc92924467f6a147a29ceb7550e7059 (patch) | |
tree | e75e5d5b3e0ac2625ef3014228a99c22a4c023a4 /package/iwinfo/src/iwinfo_cli.c | |
parent | a18a8217334edd0a00cfb5559c1440cff208fdae (diff) | |
download | mtk-20170518-64cc700dccc92924467f6a147a29ceb7550e7059.zip mtk-20170518-64cc700dccc92924467f6a147a29ceb7550e7059.tar.gz mtk-20170518-64cc700dccc92924467f6a147a29ceb7550e7059.tar.bz2 |
iwinfo: add per-station rate and mcs info to assoclist op
SVN-Revision: 30682
Diffstat (limited to 'package/iwinfo/src/iwinfo_cli.c')
-rw-r--r-- | package/iwinfo/src/iwinfo_cli.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/package/iwinfo/src/iwinfo_cli.c b/package/iwinfo/src/iwinfo_cli.c index d60d7b8..dc8ed8b 100644 --- a/package/iwinfo/src/iwinfo_cli.c +++ b/package/iwinfo/src/iwinfo_cli.c @@ -275,6 +275,34 @@ static char * format_hwmodes(int modes) return buf; } +static char * format_assocrate(struct iwinfo_rate_entry *r) +{ + static char buf[40]; + char *p = buf; + int l = sizeof(buf); + + if (r->rate <= 0) + { + snprintf(buf, sizeof(buf), "unknown"); + } + else + { + p += snprintf(p, l, "%s", format_rate(r->rate)); + l = sizeof(buf) - (p - buf); + + if (r->mcs >= 0) + { + p += snprintf(p, l, ", MCS %d, %dMHz", r->mcs, 20 + r->is_40mhz*20); + l = sizeof(buf) - (p - buf); + + if (r->is_short_gi) + p += snprintf(p, l, ", short GI"); + } + } + + return buf; +} + static const char * print_type(const struct iwinfo_ops *iw, const char *ifname) { @@ -635,11 +663,22 @@ static void print_assoclist(const struct iwinfo_ops *iw, const char *ifname) { e = (struct iwinfo_assoclist_entry *) &buf[i]; - printf("%s %s / %s (SNR %d)\n", + printf("%s %s / %s (SNR %d) %d ms ago\n", format_bssid(e->mac), format_signal(e->signal), format_noise(e->noise), - (e->signal - e->noise)); + (e->signal - e->noise), + e->inactive); + + printf(" RX: %-38s %8d Pkts.\n", + format_assocrate(&e->rx_rate), + e->rx_packets + ); + + printf(" TX: %-38s %8d Pkts.\n\n", + format_assocrate(&e->tx_rate), + e->tx_packets + ); } } |