summaryrefslogtreecommitdiff
path: root/pylibfdt
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-05-17 23:09:14 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2018-06-04 18:20:02 +1000
commitf0be81bd8de093e1c775e62b92449c9773e7f732 (patch)
treef1aa7741d599089085dda0a57788a25646f2391c /pylibfdt
parent24b1f3f064d4fde60ab7ba3ec40161edb3fab4b3 (diff)
downloaddevice-tree-compiler-f0be81bd8de093e1c775e62b92449c9773e7f732.tar.gz
Make Property a subclass of bytearray
It is annoying to have to add .value when we want the value of a Property. Make Property a subclass of bytearray so that it can be used directly when the value is required. Fix the Property class comment while we are here. Suggested-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pylibfdt')
-rw-r--r--pylibfdt/libfdt.i7
1 files changed, 4 insertions, 3 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 29695bb..2c104ac 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -418,7 +418,8 @@ class Fdt:
"""
return check_err(fdt_node_offset_by_phandle(self._fdt, phandle), quiet)
-class Property:
+
+class Property(bytearray):
"""Holds a device tree property name and value.
This holds a copy of a property taken from the device tree. It does not
@@ -427,11 +428,11 @@ class Property:
Properties:
name: Property name
- value: Proper value as a bytearray
+ value: Property value as a bytearray
"""
def __init__(self, name, value):
+ bytearray.__init__(self, value)
self.name = name
- self.value = value
%}
%rename(fdt_property) fdt_property_func;