1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01:00

hwmon: Disable if no permissions

If we don't have permissions, scan() currently raises a
TargetError. Instead we should return False from probe() so the
module is disabled
This commit is contained in:
Brendan Jackman 2017-09-21 13:30:33 +01:00
parent 25ad53feff
commit 6bb24aa12a

View File

@ -15,6 +15,7 @@
import re
from collections import defaultdict
from devlib import TargetError
from devlib.module import Module
from devlib.utils.types import integer
@ -116,7 +117,15 @@ class HwmonModule(Module):
@staticmethod
def probe(target):
return target.file_exists(HWMON_ROOT)
if not target.file_exists(HWMON_ROOT):
return False
try:
target.list_directory(HWMON_ROOT, as_root=target.is_rooted)
except TargetError:
# Probably no permissions
return False
return True
@property
def sensors(self):