Merge pull request #57 from adamliyi/adm1278

skeleton: Add dbus objects for adm1278 hwmon sensors
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 0cf55a1..bee0d4e 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -716,5 +716,27 @@
 		'101' :  { 'object_path' : 'temperature/membuf7','poll_interval' : 5000,'scale' : 1000,'units' : 'C' },
 		}
 	},
+	'4-0010' :  {
+		'names' : {
+			# Barreleye uses 0.25 millioohms sense resistor for adm1278
+			# To convert Iout register value Y to real-world value X, use an equation:
+			# X= 1/m * (Y * 10^-R - b), here m = 800 * R_sense, and R_sense is expressed in milliohms.
+			# The adm1278 driver did the conversion, but the R_sense is set here as a scale factor. 
+			'curr1_input' : { 'object_path' : 'HSCA/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
+			'in2_input' : { 'object_path' : 'HSCA/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
+		}
+	},
+	'5-0010' :  {
+		'names' : {
+			'curr1_input' : { 'object_path' : 'HSCB/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
+			'in2_input' : { 'object_path' : 'HSCB/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
+		}
+	},
+	'6-0010' :  {
+		'names' : {
+			'curr1_input' : { 'object_path' : 'HSCC/Iout','poll_interval' : 5000,'scale' : 0.25,'units' : 'mA' },
+			'in2_input' : { 'object_path' : 'HSCC/Vout','poll_interval' : 5000,'scale' : 1,'units' : 'mV' },
+		}
+	},
 }
 
diff --git a/bin/Sensors.py b/bin/Sensors.py
index 8350774..ecdac91 100755
--- a/bin/Sensors.py
+++ b/bin/Sensors.py
@@ -124,7 +124,8 @@
 			val = (self.properties[SensorValue.IFACE_NAME]['value']-offset) * scale
 			return [True,val]
 		else:
-			val = (value/scale) + offset
+			# Keep the val as integer. scale may be floating point
+			val = int(value/scale + offset)
 			if (val != self.value):
 				SensorValue.setValue(self,val)
 				self.check_thresholds(val)