[PATCH 2/8] tests: hwsim_utils start using general cmd_execute() func

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

 



The hwsim_utils used to do file operations locally in python.
Start using the cmd_execute() general function for file operations
so that this would also work on remote setups.

Signed-off-by: Jonathan Afek <jonathanx.afek@xxxxxxxxx>
---
 tests/hwsim/hwsim_utils.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tests/hwsim/hwsim_utils.py b/tests/hwsim/hwsim_utils.py
index cba9271..1f4017f 100644
--- a/tests/hwsim/hwsim_utils.py
+++ b/tests/hwsim/hwsim_utils.py
@@ -173,6 +173,8 @@ def test_connectivity_sta(dev1, dev2, dscp=None, tos=None):
 
 def set_powersave(dev, val):
     phy = dev.get_driver_status_field("phyname")
-    psf = open('/sys/kernel/debug/ieee80211/%s/hwsim/ps' % phy, 'w')
-    psf.write('%d\n' % val)
-    psf.close()
+    fname = '/sys/kernel/debug/ieee80211/%s/hwsim/ps' % phy
+    data = '%d' % val
+    (res, data) = dev.cmd_execute(["echo", data, ">", fname])
+    if 0 != res:
+        raise Exception("failed to set power save for device")
-- 
1.9.1


_______________________________________________
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