mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-19 18:31:53 +01:00
Target: add read_tree_values and read_tree_values_flat
Add two new methods to target that allow querying values of all sysfs nodes in a sub-directory structure all at once. The difference is that read_tree_values_flat returns a flat dict of path->value mappings; read_tree_values returns a nested dict structure that mimics the scanned sub-directories tree.
This commit is contained in:
@@ -195,6 +195,22 @@ cgroups_freezer_set_state() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Misc
|
||||
################################################################################
|
||||
|
||||
read_tree_values() {
|
||||
PATH=$1
|
||||
MAXDEPTH=$2
|
||||
|
||||
PATHS=$($BUSYBOX find $PATH -follow -maxdepth $MAXDEPTH)
|
||||
if [ ${#PATHS[@]} -eq 0 ]; then
|
||||
echo "ERROR: '$1' does not exist"
|
||||
else
|
||||
$BUSYBOX grep -s '' $PATHS
|
||||
fi
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main Function Dispatcher
|
||||
################################################################################
|
||||
@@ -236,6 +252,9 @@ cgroups_freezer_set_state)
|
||||
ftrace_get_function_stats)
|
||||
ftrace_get_function_stats
|
||||
;;
|
||||
read_tree_values)
|
||||
read_tree_values $*
|
||||
;;
|
||||
*)
|
||||
echo "Command [$CMD] not supported"
|
||||
exit -1
|
||||
|
Reference in New Issue
Block a user