From e79c624cddb09c6051ae3682269058ef02fe386e Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Wed, 30 Nov 2011 14:49:57 +0100 Subject: Print phandle when listing the device tree Printing the phandle of each node is quite handy when searching for a specific phandle value. Signed-off-by: Thomas Huth --- slof/fs/node.fs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'slof') diff --git a/slof/fs/node.fs b/slof/fs/node.fs index 6b8f03a..7e1bed2 100644 --- a/slof/fs/node.fs +++ b/slof/fs/node.fs @@ -295,13 +295,27 @@ defer find-node : +indent ( not-last? -- ) IF s" | " ELSE s" " THEN $indent indent @ + swap move 4 indent +! ; : -indent ( -- ) -4 indent +! ; + +: ls-phandle ( node -- ) . ." : " ; + : ls-node ( node -- ) - cr $indent indent @ type - dup peer IF ." |-- " ELSE ." +-- " THEN node>qname type ; + cr dup ls-phandle + $indent indent @ type + dup peer IF ." |-- " ELSE ." +-- " THEN + node>qname type +; + : (ls) ( node -- ) child BEGIN dup WHILE dup ls-node dup child IF dup peer +indent dup recurse -indent THEN peer REPEAT drop ; -: ls ( -- ) get-node dup cr node>path type (ls) 0 indent ! ; + +: ls ( -- ) + get-node cr + dup ls-phandle + dup node>path type + (ls) + 0 indent ! +; : show-devs ( {device-specifier} -- ) skipws 0 parse dup IF de-alias ELSE 2drop s" /" THEN ( str len ) -- cgit v1.1