From 18d2a343c7bb15f05293ea474ec572b1b2cd333e Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Wed, 18 Oct 2023 18:35:23 +0100 Subject: [PATCH] target: Add Target.read_systcl() Add a getter to query systcl values. --- devlib/target.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index 3f2f03f..3f66ede 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -1178,6 +1178,17 @@ fi await self.execute.asyn('rm -rf -- {}'.format(quote(path)), as_root=as_root) # misc + @asyn.asyncf + async def read_sysctl(self, parameter): + """ + Returns the value of the given sysctl parameter as a string. + """ + path = target.path.join('proc', 'sys', *parameter.split('.')) + try: + return await self.read_value.asyn(path) + except FileNotFoundError as e: + raise ValueError(f'systcl parameter {parameter} was not found: {e}') + def core_cpus(self, core): return [i for i, c in enumerate(self.core_names) if c == core]