aboutsummaryrefslogtreecommitdiff
path: root/pylibfdt
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-06-13 21:44:44 -0600
committerDavid Gibson <david@gibson.dropbear.id.au>2018-06-14 14:08:32 +1000
commitb770f3d1c13f63a22c7015bd2438dbc1164b5362 (patch)
treedb9e5f9cd6779aa04ed395a03f0c18f2bcadc91c /pylibfdt
parent2f0d07e678e05f260b575342867a26d466bdec85 (diff)
downloaddtc-b770f3d1c13f63a22c7015bd2438dbc1164b5362.zip
dtc-b770f3d1c13f63a22c7015bd2438dbc1164b5362.tar.gz
dtc-b770f3d1c13f63a22c7015bd2438dbc1164b5362.tar.bz2
pylibfdt: Support setting the name of a node
Add a method to call fdt_set_name(). 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.i17
1 files changed, 17 insertions, 0 deletions
diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index 2896513..aed5390 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -535,6 +535,23 @@ class Fdt:
"""
return check_err(fdt_parent_offset(self._fdt, nodeoffset), quiet)
+ def set_name(self, nodeoffset, name, quiet=()):
+ """Set the name of a node
+
+ Args:
+ nodeoffset: Node offset of node to update
+ name: New node name (string without \0)
+
+ Returns:
+ Error code, or 0 if OK
+
+ Raises:
+ FdtException if no parent found or other error occurs
+ """
+ if chr(0) in name:
+ raise ValueError('Property contains embedded nul characters')
+ return check_err(fdt_set_name(self._fdt, nodeoffset, name), quiet)
+
def setprop(self, nodeoffset, prop_name, val, quiet=()):
"""Set the value of a property