1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-07-01 00:06:22 +03:00

[package] iwinfo: assume that no tx power information is available if nl80211 returns 0 dBm maximum

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31932 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-05-28 00:52:26 +00:00
parent 8b4e17bfbc
commit 9923737295
2 changed files with 6 additions and 3 deletions

View File

@ -332,11 +332,12 @@ static int iwinfo_L_txpwrlist(lua_State *L, int (*func)(const char *, char *, in
const char *ifname = luaL_checkstring(L, 1); const char *ifname = luaL_checkstring(L, 1);
struct iwinfo_txpwrlist_entry *e; struct iwinfo_txpwrlist_entry *e;
lua_newtable(L);
memset(rv, 0, sizeof(rv)); memset(rv, 0, sizeof(rv));
if (!(*func)(ifname, rv, &len)) if (!(*func)(ifname, rv, &len))
{ {
lua_newtable(L);
for (i = 0, x = 1; i < len; i += sizeof(struct iwinfo_txpwrlist_entry), x++) for (i = 0, x = 1; i < len; i += sizeof(struct iwinfo_txpwrlist_entry), x++)
{ {
e = (struct iwinfo_txpwrlist_entry *) &rv[i]; e = (struct iwinfo_txpwrlist_entry *) &rv[i];
@ -351,9 +352,11 @@ static int iwinfo_L_txpwrlist(lua_State *L, int (*func)(const char *, char *, in
lua_rawseti(L, -2, x); lua_rawseti(L, -2, x);
} }
return 1;
} }
return 1; return 0;
} }
/* Wrapper for scan list */ /* Wrapper for scan list */

View File

@ -1371,7 +1371,7 @@ int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len)
nl80211_free(req); nl80211_free(req);
} }
if (dbm_max > -1) if (dbm_max > 0)
{ {
for (dbm_cur = 0, dbm_cnt = 0; for (dbm_cur = 0, dbm_cnt = 0;
dbm_cur < dbm_max; dbm_cur < dbm_max;