[Crosstoolchain-logs] [device-tree-compiler] 45/57: pylibfdt: Add support for fdt_get_phandle()

Vagrant Cascadian vagrant at moszumanska.debian.org
Thu Sep 28 22:04:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

vagrant pushed a commit to branch upstream/latest
in repository device-tree-compiler.

commit a198af80344cb4ffc480dc2673ee2935ea618f1d
Author: Simon Glass <sjg at chromium.org>
Date:   Sat Aug 19 11:17:57 2017 -0600

    pylibfdt: Add support for fdt_get_phandle()
    
    Add this into the class to simplify use of this function.
    
    Signed-off-by: Simon Glass <sjg at chromium.org>
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 pylibfdt/libfdt.i       | 12 ++++++++++++
 tests/pylibfdt_tests.py |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
index c7b79ec..0731202 100644
--- a/pylibfdt/libfdt.i
+++ b/pylibfdt/libfdt.i
@@ -348,6 +348,18 @@ class Fdt:
             return pdata
         return bytearray(pdata[0])
 
+    def get_phandle(self, nodeoffset):
+        """Get the phandle of a node
+
+        Args:
+            nodeoffset: Node offset to check
+
+        Returns:
+            phandle of node, or 0 if the node has no phandle or another error
+            occurs
+        """
+        return fdt_get_phandle(self._fdt, nodeoffset)
+
 
 class Property:
     """Holds a device tree property name and value.
diff --git a/tests/pylibfdt_tests.py b/tests/pylibfdt_tests.py
index 32a1daa..14820d5 100644
--- a/tests/pylibfdt_tests.py
+++ b/tests/pylibfdt_tests.py
@@ -289,5 +289,11 @@ class PyLibfdtTests(unittest.TestCase):
         node2 = self.fdt.path_offset('/subnode at 2')
         self.assertEquals(0x2000, libfdt.fdt_get_phandle(self.fdt._fdt, node2))
 
+    def testGetPhandle(self):
+        """Test for the get_phandle() method"""
+        self.assertEquals(0, self.fdt.get_phandle(0))
+        node2 = self.fdt.path_offset('/subnode at 2')
+        self.assertEquals(0x2000, self.fdt.get_phandle(node2))
+
 if __name__ == "__main__":
     unittest.main()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list