diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-28 00:52:26 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-28 00:52:26 +0000 |
commit | 672c216c6335e8872e6694be926843d5f3457e33 (patch) | |
tree | 9f2c248ced0b17871a733b324dbec4fcf497588c /package/iwinfo/src | |
parent | 6e9f473afab16887ae0f3d455d8649278ba7410a (diff) | |
download | master-187ad058-672c216c6335e8872e6694be926843d5f3457e33.tar.gz master-187ad058-672c216c6335e8872e6694be926843d5f3457e33.tar.bz2 master-187ad058-672c216c6335e8872e6694be926843d5f3457e33.zip |
[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
Diffstat (limited to 'package/iwinfo/src')
-rw-r--r-- | package/iwinfo/src/iwinfo_lua.c | 7 | ||||
-rw-r--r-- | package/iwinfo/src/iwinfo_nl80211.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/package/iwinfo/src/iwinfo_lua.c b/package/iwinfo/src/iwinfo_lua.c index e4435c1ff0..bd8faf91fe 100644 --- a/package/iwinfo/src/iwinfo_lua.c +++ b/package/iwinfo/src/iwinfo_lua.c @@ -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); struct iwinfo_txpwrlist_entry *e; - lua_newtable(L); memset(rv, 0, sizeof(rv)); if (!(*func)(ifname, rv, &len)) { + lua_newtable(L); + for (i = 0, x = 1; i < len; i += sizeof(struct iwinfo_txpwrlist_entry), x++) { 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); } + + return 1; } - return 1; + return 0; } /* Wrapper for scan list */ diff --git a/package/iwinfo/src/iwinfo_nl80211.c b/package/iwinfo/src/iwinfo_nl80211.c index 704049007a..4205336f6a 100644 --- a/package/iwinfo/src/iwinfo_nl80211.c +++ b/package/iwinfo/src/iwinfo_nl80211.c @@ -1371,7 +1371,7 @@ int nl80211_get_txpwrlist(const char *ifname, char *buf, int *len) nl80211_free(req); } - if (dbm_max > -1) + if (dbm_max > 0) { for (dbm_cur = 0, dbm_cnt = 0; dbm_cur < dbm_max; |