[PATCH skeleton 3/3] Cast dbus.Double for python-json

OpenBMC Patches openbmc-patches at stwcx.xyz
Sat Jun 25 05:11:09 AEST 2016


From: Brad Bishop <bradleyb at 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 at 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




More information about the openbmc mailing list