[PATCH 3/4] tests: Add a command for setting RSSI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Beni Lev <beni.lev@xxxxxxxxx>

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@xxxxxxxxx>
---
 tests/hwsim/hwsim_utils.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index 1fca4a2..ccac31e 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -197,3 +197,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.
+    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)
-- 
2.7.4


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux