aboutsummaryrefslogtreecommitdiffstats
path: root/package/iwinfo/src/iwinfo_cli.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-12-04 20:37:01 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-12-04 20:37:01 +0000
commit3a5a1c6ef967861ecd61ffa531398add09bbce15 (patch)
tree454302aa37566a7b2a7f06ddba356f9e221038d1 /package/iwinfo/src/iwinfo_cli.c
parent4c0321a6aa425bc90a505ff797118ac9be972676 (diff)
downloadupstream-3a5a1c6ef967861ecd61ffa531398add09bbce15.tar.gz
upstream-3a5a1c6ef967861ecd61ffa531398add09bbce15.tar.bz2
upstream-3a5a1c6ef967861ecd61ffa531398add09bbce15.zip
[package] iwinfo: expose txpower and frequency offset information
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29425 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/iwinfo/src/iwinfo_cli.c')
-rw-r--r--package/iwinfo/src/iwinfo_cli.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/package/iwinfo/src/iwinfo_cli.c b/package/iwinfo/src/iwinfo_cli.c
index bfa1d88ef9..d5be084bdb 100644
--- a/package/iwinfo/src/iwinfo_cli.c
+++ b/package/iwinfo/src/iwinfo_cli.c
@@ -311,6 +311,36 @@ static char * print_hardware_name(const struct iwinfo_ops *iw, const char *ifnam
return buf;
}
+static char * print_txpower_offset(const struct iwinfo_ops *iw, const char *ifname)
+{
+ int off;
+ static char buf[12];
+
+ if (iw->txpower_offset(ifname, &off))
+ snprintf(buf, sizeof(buf), "unknown");
+ else if (off != 0)
+ snprintf(buf, sizeof(buf), "%d dB", off);
+ else
+ snprintf(buf, sizeof(buf), "none");
+
+ return buf;
+}
+
+static char * print_frequency_offset(const struct iwinfo_ops *iw, const char *ifname)
+{
+ int off;
+ static char buf[12];
+
+ if (iw->frequency_offset(ifname, &off))
+ snprintf(buf, sizeof(buf), "unknown");
+ else if (off != 0)
+ snprintf(buf, sizeof(buf), "%.3f GHz", ((float)off / 1000.0));
+ else
+ snprintf(buf, sizeof(buf), "none");
+
+ return buf;
+}
+
static char * print_ssid(const struct iwinfo_ops *iw, const char *ifname)
{
char buf[IWINFO_ESSID_MAX_SIZE+1] = { 0 };
@@ -473,6 +503,10 @@ static void print_info(const struct iwinfo_ops *iw, const char *ifname)
printf(" Hardware: %s [%s]\n",
print_hardware_id(iw, ifname),
print_hardware_name(iw, ifname));
+ printf(" TX power offset: %s\n",
+ print_txpower_offset(iw, ifname));
+ printf(" Frequency offset: %s\n",
+ print_frequency_offset(iw, ifname));
printf(" Supports VAPs: %s\n",
print_mbssid_supp(iw, ifname));
}