fixed file not found when hwmon was not fully initialized on startup
This commit is contained in:
9
pyfan.py
9
pyfan.py
@@ -87,8 +87,13 @@ class ThermalZone:
|
||||
sysfs_f.write(str(value))
|
||||
|
||||
def read_sysfs(self, path):
|
||||
with open(self.build_pwm_path(path)) as sysfs_f:
|
||||
return sysfs_f.readline()
|
||||
try:
|
||||
with open(self.build_pwm_path(path)) as sysfs_f:
|
||||
return sysfs_f.readline()
|
||||
except FileNotFoundError as err:
|
||||
logging.getLogger("pyfan").warning(
|
||||
"[%s] temp source not found. Not ready yet or wrong path? (%s)" % (self.name,
|
||||
err.strerror))
|
||||
|
||||
def set_pwm_mode(self, path, value=1):
|
||||
self.write_sysfs(path + "_enable", value)
|
||||
|
Reference in New Issue
Block a user