This fills in the props and subnodes properties, recursively
searching into subnodes so that the entire tree is built.
"""
- for name, byte_list_str in self._fdt.GetProps(self.path).iteritems():
+ for name, byte_list_str in self._fdt.GetProps(self.path).items():
prop = Prop(self, name, byte_list_str)
self.props[name] = prop
node.Scan()
+ def DeleteProp(self, prop_name):
+ """Delete a property of a node
+
+ The property is deleted using fdtput.
+
+ Args:
+ prop_name: Name of the property to delete
+ Raises:
+ CommandError if the property does not exist
+ """
+ args = [self._fdt._fname, '-d', self.path, prop_name]
+ command.Output('fdtput', *args)
+ del self.props[prop_name]
class FdtFallback(Fdt):
"""Provides simple access to a flat device tree blob using fdtget/fdtput
out = command.Output('fdtget', self._fname, '-l', node)
return out.strip().splitlines()
- def GetProps(self, node, convert_dashes=False):
+ def GetProps(self, node):
"""Get all properties from a node
Args:
node: full path to node name to look in
- convert_dashes: True to convert - to _ in node names
Returns:
A dictionary containing all the properties, indexed by node name.
props_dict = {}
for prop in props:
name = prop
- if convert_dashes:
- prop = re.sub('-', '_', prop)
props_dict[prop] = self.GetProp(node, name)
return props_dict
if default is not None:
args += ['-d', str(default)]
if typespec is not None:
- args += ['-t%s' % typespec]
+ args += ['-t', typespec]
out = command.Output('fdtget', *args)
return out.strip()