Skip to content

Commit

Permalink
nl80211: put current TX power in interface info
Browse files Browse the repository at this point in the history
Many drivers implement reading current TX power (using either cfg80211
or ieee80211 op) but userspace can't get it using nl80211. Right now the
only way to access it is to call some wext ioctl.
Let's put TX power in interface info reply (callback is wdev specific)
just like we do with current channel.
To be consistent (e.g. NL80211_CMD_SET_WIPHY) let's use mBm as na unit.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
rmilecki authored and jmberg-intel committed Sep 22, 2015
1 parent 0edd5fa commit d55d0d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,16 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
}
}

if (rdev->ops->get_tx_power) {
int dbm, ret;

ret = rdev_get_tx_power(rdev, wdev, &dbm);
if (ret == 0 &&
nla_put_u32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL,
DBM_TO_MBM(dbm)))
goto nla_put_failure;
}

if (wdev->ssid_len) {
if (nla_put(msg, NL80211_ATTR_SSID, wdev->ssid_len, wdev->ssid))
goto nla_put_failure;
Expand Down

0 comments on commit d55d0d5

Please sign in to comment.