summaryrefslogtreecommitdiffstats
path: root/pyhwmon
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2016-06-24 08:16:19 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2016-06-24 13:17:29 -0400
commitbd01c24d18852f4e03582d14ecde7c4d0f81fc4e (patch)
tree598268913dc37a12d660257d67231853593deed5 /pyhwmon
parent3e47968a8d3fbf1a4345ef8f4907f73436c0f3af (diff)
downloadtalos-skeleton-bd01c24d18852f4e03582d14ecde7c4d0f81fc4e.tar.gz
talos-skeleton-bd01c24d18852f4e03582d14ecde7c4d0f81fc4e.zip
Revert "Don't make pointless sensor update method calls"
This reverts commit efc689707d21f36c0ed8f0b1af474d2087ef8f95. This enhancement breaks the ability to set the sensor value via user-interface. Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'pyhwmon')
-rw-r--r--pyhwmon/hwmon.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/pyhwmon/hwmon.py b/pyhwmon/hwmon.py
index d9c1353..e5dc19a 100644
--- a/pyhwmon/hwmon.py
+++ b/pyhwmon/hwmon.py
@@ -39,7 +39,6 @@ class Hwmons():
self.hwmon_root = { }
self.scanDirectory()
gobject.timeout_add(DIR_POLL_INTERVAL, self.scanDirectory)
- self.cache = {}
def readAttribute(self,filename):
val = "-1"
@@ -55,30 +54,17 @@ class Hwmons():
with open(filename, 'w') as f:
f.write(str(value)+'\n')
- def should_update(attribute, value):
- if attribute not in self.cache:
- self.cache[attribute] = value
- return True
-
- update = (value != self.cache[attribute])
- self.cache[attribute] = value
-
- return update
def poll(self,objpath,attribute):
try:
raw_value = int(self.readAttribute(attribute))
- if self.should_update(attribute, raw_value):
- obj = bus.get_object(SENSOR_BUS,objpath,introspect=False)
- intf = dbus.Interface(obj,HwmonSensor.IFACE_NAME)
- rtn = intf.setByPoll(raw_value)
- if (rtn[0] == True):
- self.writeAttribute(attribute,rtn[1])
+ obj = bus.get_object(SENSOR_BUS,objpath,introspect=False)
+ intf = dbus.Interface(obj,HwmonSensor.IFACE_NAME)
+ rtn = intf.setByPoll(raw_value)
+ if (rtn[0] == True):
+ self.writeAttribute(attribute,rtn[1])
except:
print "HWMON: Attibute no longer exists: "+attribute
- self.sensors.pop(objpath,None)
- if attribute in self.cache:
- del self.cache[attribute]
return False
OpenPOWER on IntegriCloud