From b9b4d9a2ab2c74b284ecbaa6afae52f7792659f7 Mon Sep 17 00:00:00 2001 From: Vasilis Tsiligiannis Date: Thu, 24 Dec 2009 21:34:57 +0000 Subject: [PATCH] libs/iwinfo: Respect IW_TXPOW_DBM flag over IW_TXPOW_MWATT when both are set --- libs/iwinfo/src/iwinfo_wext.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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)); } -- 2.25.1