1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-05 04:25:05 +02:00

[package] iwinfo: factor tx power offset into power level listing

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29430 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2011-12-04 22:04:00 +00:00
parent de1bb6ef97
commit 735b44ac69

View File

@ -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) 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]; char buf[IWINFO_BUFSIZE];
struct iwinfo_txpwrlist_entry *e; 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)) if (iw->txpower(ifname, &pwr))
pwr = -1; pwr = -1;
if (iw->txpower_offset(ifname, &off))
off = 0;
for (i = 0; i < len; i += sizeof(struct iwinfo_txpwrlist_entry)) for (i = 0; i < len; i += sizeof(struct iwinfo_txpwrlist_entry))
{ {
e = (struct iwinfo_txpwrlist_entry *) &buf[i]; e = (struct iwinfo_txpwrlist_entry *) &buf[i];
printf("%s%3d dBm (%4d mW)\n", printf("%s%3d dBm (%4d mW)\n",
(pwr == e->dbm) ? "*" : " ", (pwr == e->dbm) ? "*" : " ",
e->dbm, e->dbm + off,
e->mw); iwinfo_dbm2mw(e->dbm + off));
} }
} }