1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-01 09:31:53 +01:00

target: Add Target.revertable_write_value()

Same as write_value(), but returns a context manager that will write
back the old value on exit.

Also add batch_revertable_write_value() that takes a list of kwargs
dict, and will call revertable_write_value() on each of them, returning
a single combined context manager.
This commit is contained in:
Douglas RAILLARD
2019-05-09 16:24:29 +01:00
committed by Marc Bonnici
parent ded30eef00
commit 988de69b61
2 changed files with 26 additions and 1 deletions

View File

@@ -346,6 +346,18 @@ Target
some sysfs entries silently failing to set the written value without
returning an error code.
.. method:: Target.revertable_write_value(path, value [, verify])
Same as :meth:`Target.write_value`, but as a context manager that will write
back the previous value on exit.
.. method:: Target.batch_revertable_write_value(kwargs_list)
Calls :meth:`Target.revertable_write_value` with all the keyword arguments
dictionary given in the list. This is a convenience method to update
multiple files at once, leaving them in their original state on exit. If one
write fails, all the already-performed writes will be reverted as well.
.. method:: Target.read_tree_values(path, depth=1, dictcls=dict, [, tar [, decode_unicode [, strip_null_char ]]]):
Read values of all sysfs (or similar) file nodes under ``path``, traversing