From: Vasilis Tsiligiannis Date: Thu, 24 Dec 2009 21:34:57 +0000 (+0000) Subject: libs/iwinfo: Respect IW_TXPOW_DBM flag over IW_TXPOW_MWATT when both are set X-Git-Tag: 0.10.0~873 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b9b4d9a2ab2c74b284ecbaa6afae52f7792659f7;p=oweals%2Fluci.git libs/iwinfo: Respect IW_TXPOW_DBM flag over IW_TXPOW_MWATT when both are set --- diff --git a/libs/iwinfo/src/iwinfo_wext.c b/libs/iwinfo/src/iwinfo_wext.c index eebaea6af..2a1b685c4 100644 --- a/libs/iwinfo/src/iwinfo_wext.c +++ b/libs/iwinfo/src/iwinfo_wext.c @@ -373,17 +373,18 @@ int wext_get_txpwrlist(const char *ifname, char *buf, int *len) ) { for( i = 0; i < range.num_txpower; i++ ) { - if( range.txpower_capa & IW_TXPOW_MWATT ) - { - entry.dbm = wext_mw2dbm(range.txpower[i]); - entry.mw = range.txpower[i]; - } - else + if( range.txpower_capa & IW_TXPOW_DBM ) { entry.dbm = range.txpower[i]; entry.mw = wext_dbm2mw(range.txpower[i]); } + else if( range.txpower_capa & IW_TXPOW_MWATT ) + { + entry.dbm = wext_mw2dbm(range.txpower[i]); + entry.mw = range.txpower[i]; + } + memcpy(&buf[i*sizeof(entry)], &entry, sizeof(entry)); }