diff options
author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2016-08-30 19:56:58 -0400 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-09-06 12:46:19 +0000 |
commit | 67a6f45b19ab1a6fddf4e9a116399d35a912d5f3 (patch) | |
tree | 388a546de937edf00a726af489829f543913c324 /pyhwmon/hwmon.py | |
parent | 2fa78fbe8a7cb97d158b98d261c43708a7df0470 (diff) | |
download | blackbird-skeleton-67a6f45b19ab1a6fddf4e9a116399d35a912d5f3.tar.gz blackbird-skeleton-67a6f45b19ab1a6fddf4e9a116399d35a912d5f3.zip |
hwmon: allow missing config file
Allow hwmon to at least start without a board config file.
Change-Id: I53114671d91f887be1bf4a4b9207ece68fa2d0ce
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'pyhwmon/hwmon.py')
-rw-r--r-- | pyhwmon/hwmon.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pyhwmon/hwmon.py b/pyhwmon/hwmon.py index 0b6cf5f..12cfa05 100644 --- a/pyhwmon/hwmon.py +++ b/pyhwmon/hwmon.py @@ -12,7 +12,12 @@ from obmc.dbuslib.bindings import get_dbus from obmc.sensors import SensorValue as SensorValue from obmc.sensors import HwmonSensor as HwmonSensor from obmc.sensors import SensorThresholds as SensorThresholds -import obmc_system_config as System + +try: + import obmc_system_config as System + have_system = True +except ImportError: + have_system = False SENSOR_BUS = 'org.openbmc.Sensors' SENSOR_PATH = '/org/openbmc/sensors' @@ -38,8 +43,10 @@ class Hwmons(): def __init__(self, bus): self.sensors = {} self.hwmon_root = {} - self.scanDirectory() - gobject.timeout_add(DIR_POLL_INTERVAL, self.scanDirectory) + + if have_system: + self.scanDirectory() + gobject.timeout_add(DIR_POLL_INTERVAL, self.scanDirectory) def readAttribute(self, filename): val = "-1" |