hwsim_utils.set_powersace() 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@intel.com>
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], shell=True)
+ if res != 0:
+ raise Exception("Failed to set power save for device")