libs/iwinfo: Respect IW_TXPOW_DBM flag over IW_TXPOW_MWATT when both are set
authorVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Thu, 24 Dec 2009 21:34:57 +0000 (21:34 +0000)
committerVasilis Tsiligiannis <b_tsiligiannis@silverton.gr>
Thu, 24 Dec 2009 21:34:57 +0000 (21:34 +0000)
libs/iwinfo/src/iwinfo_wext.c

index eebaea6af8c9061b374db18c16c9ce88f61dec3b..2a1b685c4664a85908e3be57070651b685cccbcc 100644 (file)
@@ -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));
                }