From: Jo-Philipp Wich Date: Sun, 4 Dec 2011 22:04:00 +0000 (+0000) Subject: iwinfo: factor tx power offset into power level listing X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d3d91930d167026e95d3e792b0a188c24555c809;p=openwrt%2Fstaging%2Fthess.git iwinfo: factor tx power offset into power level listing SVN-Revision: 29430 --- diff --git a/package/iwinfo/src/iwinfo_cli.c b/package/iwinfo/src/iwinfo_cli.c index d5be084bdb..4f8f5612c7 100644 --- a/package/iwinfo/src/iwinfo_cli.c +++ b/package/iwinfo/src/iwinfo_cli.c @@ -553,7 +553,7 @@ static void print_scanlist(const struct iwinfo_ops *iw, const char *ifname) static void print_txpwrlist(const struct iwinfo_ops *iw, const char *ifname) { - int len, pwr, i; + int len, pwr, off, i; char buf[IWINFO_BUFSIZE]; struct iwinfo_txpwrlist_entry *e; @@ -566,14 +566,17 @@ static void print_txpwrlist(const struct iwinfo_ops *iw, const char *ifname) if (iw->txpower(ifname, &pwr)) pwr = -1; + if (iw->txpower_offset(ifname, &off)) + off = 0; + for (i = 0; i < len; i += sizeof(struct iwinfo_txpwrlist_entry)) { e = (struct iwinfo_txpwrlist_entry *) &buf[i]; printf("%s%3d dBm (%4d mW)\n", (pwr == e->dbm) ? "*" : " ", - e->dbm, - e->mw); + e->dbm + off, + iwinfo_dbm2mw(e->dbm + off)); } }