Merge pull request #21 from causten/sensors

Updated to sensor2 features
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index 2623dae..306f293 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -106,13 +106,14 @@
 		'system_state'    : 'BMC_STARTING',
 		'start_process'   : True,
 		'monitor_process' : True,
-		'process_name'    : 'sensors_virtual_p8.py',
+		'process_name'    : 'hwmon.py',
+		'args'            : [ SYSTEM_NAME ]
 	},
 	'sensor_manager' : {
 		'system_state'    : 'BASE_APPS',
 		'start_process'   : True,
 		'monitor_process' : True,
-		'process_name'    : 'sensor_manager.py',
+		'process_name'    : 'sensor_manager2.py',
 		'args'            : [ SYSTEM_NAME ]
 	},
 	'host_watchdog' : {
@@ -394,8 +395,6 @@
 		'PRODUCT_43'   : '<inventory_root>/system/chassis/motherboard/dimm31',
 	},
 	'SENSOR' : {
-                0x35 : '<inventory_root>/system',
-		0x33 : '<inventory_root>/system/powercap',
 		0x35 : '<inventory_root>/system/systemevent',
 		0x36 : '<inventory_root>/system/powerlimit',
                 0x34 : '<inventory_root>/system/chassis/motherboard',
@@ -470,11 +469,12 @@
                 0x2d : '<inventory_root>/system/chassis/motherboard/dimm29',
                 0x2e : '<inventory_root>/system/chassis/motherboard/dimm30',
                 0x2f : '<inventory_root>/system/chassis/motherboard/dimm31',	
-		0x09 : '/org/openbmc/sensor/virtual/BootCount',
-		0x05 : '/org/openbmc/sensor/virtual/BootProgress',
-		0x04 : '/org/openbmc/sensor/virtual/HostStatus',
-		0x08 : '/org/openbmc/sensor/virtual/OccStatus',
-		0x32 : '/org/openbmc/sensor/virtual/OperatingSystemStatus',
+		0x09 : '/org/openbmc/sensors/host/BootCount',
+		0x05 : '/org/openbmc/sensors/host/BootProgress',
+		0x04 : '/org/openbmc/sensors/host/HostStatus',
+		0x08 : '/org/openbmc/sensors/host/OccStatus',
+		0x32 : '/org/openbmc/sensors/host/OperatingSystemStatus',
+		0x33 : '/org/openbmc/sensors/host/powercap',
 	},
 	'GPIO_PRESENT' : {
 		'SLOT0_RISER_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0_riser', 
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index 90fd305..3c7d9bd 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -89,13 +89,14 @@
 		'system_state'    : 'BMC_STARTING',
 		'start_process'   : True,
 		'monitor_process' : True,
-		'process_name'    : 'sensors_virtual_p8.py',
+		'process_name'    : 'hwmon.py',
+		'args'            : [ SYSTEM_NAME ]
 	},
 	'sensor_manager' : {
 		'system_state'    : 'BASE_APPS',
 		'start_process'   : True,
 		'monitor_process' : True,
-		'process_name'    : 'sensor_manager.py',
+		'process_name'    : 'sensor_manager2.py',
 		'args'            : [ SYSTEM_NAME ]
 	},
 	'host_watchdog' : {
@@ -201,6 +202,11 @@
 	'<inventory_root>/system/chassis/io_board/pcie_slot0' : { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,},
 	'<inventory_root>/system/chassis/io_board/pcie_slot1' : { 'fru_type' : 'PCIE_CARD', 'is_fru' : True,},
 
+	'<inventory_root>/system/systemevent'                  : { 'fru_type' : 'SYSTEM_EVENT', 'is_fru' : False, },
+	'<inventory_root>/system/chassis/motherboard/refclock' : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, },
+	'<inventory_root>/system/chassis/motherboard/pcieclock': { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, },
+	'<inventory_root>/system/chassis/motherboard/todclock' : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, },
+	'<inventory_root>/system/chassis/motherboard/apss'     : { 'fru_type' : 'MAIN_PLANAR', 'is_fru' : False, },
 }
 
 ID_LOOKUP = {
@@ -220,12 +226,19 @@
 		'CHASSIS_2' : '<inventory_root>/system/chassis',
 		'BOARD_1'   : '<inventory_root>/system/chassis/motherboard/cpu0',
 		'BOARD_2'   : '<inventory_root>/system/chassis/motherboard/centaur0',
+		'BOARD_14'   : '<inventory_root>/system/chassis/motherboard',
 		'PRODUCT_3'   : '<inventory_root>/system/chassis/motherboard/dimm0',
 		'PRODUCT_4'   : '<inventory_root>/system/chassis/motherboard/dimm1',
 		'PRODUCT_5'   : '<inventory_root>/system/chassis/motherboard/dimm2',
 		'PRODUCT_6'   : '<inventory_root>/system/chassis/motherboard/dimm3',
 	},
 	'SENSOR' : {
+		0x34 : '<inventory_root>/system/chassis/motherboard',
+		0x35 : '<inventory_root>/system/systemevent',
+		0x37 : '<inventory_root>/system/chassis/motherboard/refclock',
+		0x38 : '<inventory_root>/system/chassis/motherboard/pcieclock',
+		0x39 : '<inventory_root>/system/chassis/motherboard/todclock',
+		0x3A : '<inventory_root>/system/chassis/motherboard/apss',
 		0x2f : '<inventory_root>/system/chassis/motherboard/cpu0',
 		0x22 : '<inventory_root>/system/chassis/motherboard/cpu0/core0',
 		0x23 : '<inventory_root>/system/chassis/motherboard/cpu0/core1',
@@ -244,15 +257,15 @@
 		0x1f : '<inventory_root>/system/chassis/motherboard/dimm1',
 		0x20 : '<inventory_root>/system/chassis/motherboard/dimm2',
 		0x21 : '<inventory_root>/system/chassis/motherboard/dimm3',
-		0x09 : '/org/openbmc/sensor/virtual/BootCount',
-		0x05 : '/org/openbmc/sensor/virtual/BootProgress',
-		0x04 : '/org/openbmc/sensor/virtual/HostStatus',
-		0x08 : '/org/openbmc/sensor/virtual/OccStatus',
-		0x32 : '/org/openbmc/sensor/virtual/OperatingSystemStatus',
+		0x09 : '/org/openbmc/sensors/host/BootCount',
+		0x05 : '/org/openbmc/sensors/host/BootProgress',
+		0x08 : '/org/openbmc/sensors/host/OccStatus',
+		0x32 : '/org/openbmc/sensors/host/OperatingSystemStatus',
+		0x33 : '/org/openbmc/sensors/host/PowerCap',
 	},
 	'GPIO_PRESENT' : {
-		'SLOT0_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0', 
-		'SLOT1_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot1', 
+		'SLOT0_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot0',
+		'SLOT1_PRESENT' : '<inventory_root>/system/chassis/io_board/pcie_slot1',
 	}
 }
 
@@ -283,7 +296,4 @@
 	offset = int(name[1:])
 	a = ord(c)-65
 	base = a*8+GPIO_BASE
-	return base+offset
-
-
-
+	return base+offset
\ No newline at end of file
diff --git a/bin/Sensors.py b/bin/Sensors.py
index e2b79ac..a143a8f 100755
--- a/bin/Sensors.py
+++ b/bin/Sensors.py
@@ -120,20 +120,11 @@
 			return [False,0]
 		
 CONTROL_IFACE = 'org.openbmc.Control'
-class HostStatusSensor(VirtualSensor):
+class PowerCap(VirtualSensor):
 	def __init__(self,bus,name):
 		VirtualSensor.__init__(self,bus,name)
-		self.setValue("Off")
+		self.setValue(100)
 
-	##override setValue method
-	@dbus.service.method(SensorValue.IFACE_NAME,
-		in_signature='v', out_signature='')
-	def setValue(self,value):
-		SensorValue.setValue(self,value)
-			
-	@dbus.service.signal(CONTROL_IFACE,signature='s')
-	def GotoSystemState(self,state):
-		pass
 		
 class BootProgressSensor(VirtualSensor):
 	def __init__(self,bus,name):
@@ -192,7 +183,7 @@
 class BootCountSensor(VirtualSensor):
 	def __init__(self,bus,name):
 		VirtualSensor.__init__(self,bus,name)
-		self.setValue(0)
+		self.setValue(2)
 
 class OperatingSystemStatusSensor(VirtualSensor):
 	def __init__(self,bus,name):
diff --git a/bin/sensor_manager2.py b/bin/sensor_manager2.py
index 5e044f0..5964263 100755
--- a/bin/sensor_manager2.py
+++ b/bin/sensor_manager2.py
@@ -52,8 +52,8 @@
 	## these don't need to be in seperate process
 	## TODO: this should not be hardcoded
 
-	obj_path = OBJ_PATH+"/host/HostStatus"
-	root_sensor.add(obj_path,Sensors.HostStatusSensor(bus,obj_path))
+	obj_path = OBJ_PATH+"/host/PowerCap"
+	root_sensor.add(obj_path,Sensors.PowerCap(bus,obj_path))
 	obj_path = OBJ_PATH+"/host/BootProgress"
 	root_sensor.add(obj_path,Sensors.BootProgressSensor(bus,obj_path))
 	obj_path = OBJ_PATH+"/host/OccStatus"