]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add a command for setting TX power/RSSI
authorBeni Lev <beni.lev@intel.com>
Mon, 21 Aug 2017 16:43:54 +0000 (19:43 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 1 Jan 2019 16:18:53 +0000 (18:18 +0200)
With this command, RSSI signal can be controlled. Due to restrictions in
kernel, only values in the range of [-30, -50] can be used. The command
is implemented by changing the TX power.

Signed-off-by: Beni Lev <beni.lev@intel.com>
tests/hwsim/hwsim_utils.py

index 84f87a5a3d0c7993262beb4a319c83a6918f4fc4..718d53f464e762f68ea03da5c1af9ddcf44b0c4b 100644 (file)
@@ -238,3 +238,20 @@ def set_group_map(dev, val):
     (res, data) = dev.cmd_execute(["echo", data, ">", fname], shell=True)
     if res != 0:
         raise Exception("Failed to set group map for %s" % phy)
+
+def set_rx_rssi(dev, val):
+    """
+    Configure signal strength when receiving transmitted frames.
+    mac80211_hwsim driver sets rssi to: TX power - 50
+    According to that set tx_power in order to get the desired RSSI.
+    Valid RSSI range: -50 to -30.
+    """
+    tx_power = (val + 50) * 100
+    ifname = dev.get_driver_status_field("ifname")
+    (res, data) = dev.cmd_execute([ 'iw', ifname, 'set', 'txpower',
+                                    'fixed', str(tx_power)] )
+    if res != 0:
+        raise Exception("Failed to set RSSI to %d" % val)
+
+def reset_rx_rssi(dev):
+    set_rx_rssi(dev, -30)