1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-02-07 05:30:44 +00:00

Merge pull request #177 from bjackman/hwmon-no-permissions

hwmon: Disable if no permissions
This commit is contained in:
setrofim 2017-10-02 10:37:25 +01:00 committed by GitHub
commit e21265f6f6

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):