From f6bbd2c1879bb23bb7cdf97bf9fc302f6660de0f Mon Sep 17 00:00:00 2001
From: Douglas Raillard <douglas.raillard@arm.com>
Date: Tue, 5 Apr 2022 12:39:45 +0100
Subject: [PATCH] modules/sched: Use correct permissions to read debugfs

Use target.list_directory(as_root=target.is_rooted) instead of doing it
as a normal user for paths in /sys/kernel/debug. Since this
list_directory() call can be used with multiple path, we do not force
as_root=True but we increase the chance of it working.
---
 devlib/module/sched.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/devlib/module/sched.py b/devlib/module/sched.py
index c6ab3d4..e1d526d 100644
--- a/devlib/module/sched.py
+++ b/devlib/module/sched.py
@@ -329,7 +329,7 @@ class SchedProcFSData(SchedProcFSNode):
         except TargetStableError:
             return False
 
-        cpus = target.list_directory(path)
+        cpus = target.list_directory(path, as_root=target.is_rooted)
         if not cpus:
             return False