* [PATCH skeleton 0/3] dbus.Double and revert sensor cache
@ 2016-06-24 19:11 OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 1/3] Revert "Fix broken attempt at hwmon caching" OpenBMC Patches
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: OpenBMC Patches @ 2016-06-24 19:11 UTC (permalink / raw)
To: openbmc
The sensor cache does not work. The revert addresses https://github.com/openbmc/skeleton/issues/113.
The python json encoder has trouble converting dbus.Double to a float. Floating point sensors were added with https://github.com/openbmc/skeleton/commit/a8260c83d6566fc46832c627ae32c996cfb76ea4. Resolves https://github.com/openbmc/skeleton/issues/112.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/openbmc/skeleton/114)
<!-- Reviewable:end -->
https://github.com/openbmc/skeleton/pull/114
Brad Bishop (3):
Revert "Fix broken attempt at hwmon caching"
Revert "Don't make pointless sensor update method calls"
Cast dbus.Double for python-json
pyhwmon/hwmon.py | 24 +++++-------------------
pytools/obmcutil | 3 +++
2 files changed, 8 insertions(+), 19 deletions(-)
--
2.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH skeleton 1/3] Revert "Fix broken attempt at hwmon caching"
2016-06-24 19:11 [PATCH skeleton 0/3] dbus.Double and revert sensor cache OpenBMC Patches
@ 2016-06-24 19:11 ` OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 2/3] Revert "Don't make pointless sensor update method calls" OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 3/3] Cast dbus.Double for python-json OpenBMC Patches
2 siblings, 0 replies; 4+ messages in thread
From: OpenBMC Patches @ 2016-06-24 19:11 UTC (permalink / raw)
To: openbmc; +Cc: Brad Bishop
From: Brad Bishop <bradleyb@fuzziesquirrel.com>
This reverts commit 8224ff87c914861d28ed0dc6a251ba213a9ee607.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
---
pyhwmon/hwmon.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyhwmon/hwmon.py b/pyhwmon/hwmon.py
index e7821f4..d9c1353 100644
--- a/pyhwmon/hwmon.py
+++ b/pyhwmon/hwmon.py
@@ -55,7 +55,7 @@ class Hwmons():
with open(filename, 'w') as f:
f.write(str(value)+'\n')
- def should_update(self, attribute, value):
+ def should_update(attribute, value):
if attribute not in self.cache:
self.cache[attribute] = value
return True
--
2.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH skeleton 2/3] Revert "Don't make pointless sensor update method calls"
2016-06-24 19:11 [PATCH skeleton 0/3] dbus.Double and revert sensor cache OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 1/3] Revert "Fix broken attempt at hwmon caching" OpenBMC Patches
@ 2016-06-24 19:11 ` OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 3/3] Cast dbus.Double for python-json OpenBMC Patches
2 siblings, 0 replies; 4+ messages in thread
From: OpenBMC Patches @ 2016-06-24 19:11 UTC (permalink / raw)
To: openbmc; +Cc: Brad Bishop
From: Brad Bishop <bradleyb@fuzziesquirrel.com>
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>
---
pyhwmon/hwmon.py | 24 +++++-------------------
1 file 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
--
2.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH skeleton 3/3] Cast dbus.Double for python-json
2016-06-24 19:11 [PATCH skeleton 0/3] dbus.Double and revert sensor cache OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 1/3] Revert "Fix broken attempt at hwmon caching" OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 2/3] Revert "Don't make pointless sensor update method calls" OpenBMC Patches
@ 2016-06-24 19:11 ` OpenBMC Patches
2 siblings, 0 replies; 4+ messages in thread
From: OpenBMC Patches @ 2016-06-24 19:11 UTC (permalink / raw)
To: openbmc; +Cc: Brad Bishop
From: Brad Bishop <bradleyb@fuzziesquirrel.com>
At some point a floating point value was added to a sensor
object.
python-json doesn't handle the dbus wrapper types like
dbus.Double. Cast dbus.Double to a float, similar to integers.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
---
pytools/obmcutil | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pytools/obmcutil b/pytools/obmcutil
index 6db589e..9207eca 100644
--- a/pytools/obmcutil
+++ b/pytools/obmcutil
@@ -16,6 +16,9 @@ def fix_byte(it,key,parent):
elif (isinstance(it,dbus.Byte)):
if (key != None):
parent[key] = int(it)
+ elif (isinstance(it,dbus.Double)):
+ if (key != None):
+ parent[key] = float(it)
else:
pass
--
2.9.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-24 19:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 19:11 [PATCH skeleton 0/3] dbus.Double and revert sensor cache OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 1/3] Revert "Fix broken attempt at hwmon caching" OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 2/3] Revert "Don't make pointless sensor update method calls" OpenBMC Patches
2016-06-24 19:11 ` [PATCH skeleton 3/3] Cast dbus.Double for python-json OpenBMC Patches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.