1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-07 22:02:42 +01:00

Device: Updated to set and retrieve binary data from sysfiles

`set_sysfile_values` now accepts a `^` symbol prefixed to the
file path to indicated that the value should be written as binary data.
To accommodate this an extra `binary` flag has been added to  the `set_sysfile_value`and `get_sysfile_value` methods to write and retrieve the binary data respectively.
This commit is contained in:
Marc Bonnici
2017-04-04 17:32:10 +01:00
parent 35df2fff30
commit 50236b0661
2 changed files with 42 additions and 14 deletions

View File

@@ -394,7 +394,7 @@ class Device(Extension):
"""
self.execute("sleep {}".format(seconds), timeout=seconds + 10)
def set_sysfile_value(self, filepath, value, verify=True):
def set_sysfile_value(self, filepath, value, verify=True, binary=False):
"""
Write the specified value to the specified file on the device
and verify that the value has actually been written.
@@ -403,13 +403,14 @@ class Device(Extension):
:param value: The value to be written to the file. Must be
an int or a string convertable to an int.
:param verify: Specifies whether the value should be verified, once written.
:param binary: Specifies whether the value should be written as binary data.
Should raise DeviceError if could write value.
"""
raise NotImplementedError()
def get_sysfile_value(self, sysfile, kind=None):
def get_sysfile_value(self, sysfile, kind=None, binary=False):
"""
Get the contents of the specified sysfile.
@@ -419,6 +420,8 @@ class Device(Extension):
be any Python callable that takes a single str argument.
If not specified or is None, the contents will be returned
as a string.
:param binary: Whether the value should be encoded into base64 for reading
to deal with binary format.
"""
raise NotImplementedError()