From ae7f01fd192ffb859f5ca067311169a817d73b1f Mon Sep 17 00:00:00 2001 From: Marc Bonnici Date: Fri, 24 May 2019 11:15:46 +0100 Subject: [PATCH] target: Use root if available when determine number of cpus On some targets some entries in `/sys/devices/system/cpu` require root to list otherwise will return a permission error. --- devlib/target.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devlib/target.py b/devlib/target.py index 92a6839..8643f13 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -155,7 +155,7 @@ class Target(object): def number_of_cpus(self): num_cpus = 0 corere = re.compile(r'^\s*cpu\d+\s*$') - output = self.execute('ls /sys/devices/system/cpu') + output = self.execute('ls /sys/devices/system/cpu', as_root=self.is_rooted) for entry in output.split(): if corere.match(entry): num_cpus += 1