added ObjectAdded signal
diff --git a/bin/chassis_control.py b/bin/chassis_control.py
index 0cac579..dc5dee4 100755
--- a/bin/chassis_control.py
+++ b/bin/chassis_control.py
@@ -49,11 +49,16 @@
 		self.Set(DBUS_NAME,"last_system_state","")	
 
 		bus.add_signal_receiver(self.power_button_signal_handler, 
-					dbus_interface = "org.openbmc.Button", signal_name = "ButtonPressed", 
+					dbus_interface = "org.openbmc.Button", signal_name = "Released", 
 					path="/org/openbmc/buttons/power0" )
+		bus.add_signal_receiver(self.reset_button_signal_handler, 
+					dbus_interface = "org.openbmc.Button", signal_name = "Pressed_Long", 
+					path="/org/openbmc/buttons/power0" )
+
     		bus.add_signal_receiver(self.host_watchdog_signal_handler, 
 					dbus_interface = "org.openbmc.Watchdog", signal_name = "WatchdogError")
 		bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
+		self.ObjectAdded(name,CONTROL_INTF)
 
 
 	def getInterface(self,name):
@@ -114,8 +119,11 @@
 		in_signature='', out_signature='')
 	def reboot(self):
 		print "Rebooting"
-		self.Set(DBUS_NAME,"reboot",1)
-		intf.softPowerOff()
+		if state == POWER_OFF:
+			self.powerOn();
+		else:
+			self.Set(DBUS_NAME,"reboot",1)
+			intf.softPowerOff()
 		return None
 
 	@dbus.service.method(DBUS_NAME,
@@ -151,9 +159,10 @@
 			self.powerOn()
 		elif state == POWER_ON:
 			self.powerOff();
-		
-		# TODO: handle long press and reset
 
+	def reset_button_signal_handler(self):
+		self.reboot();
+		
 	def host_watchdog_signal_handler(self):
 		print "Watchdog Error, Hard Rebooting"
 		#self.Set(DBUS_NAME,"reboot",1)
diff --git a/bin/inventory_items.py b/bin/inventory_items.py
index ab1aae3..e961683 100755
--- a/bin/inventory_items.py
+++ b/bin/inventory_items.py
@@ -23,10 +23,11 @@
 
 FRUS = System.FRU_INSTANCES
 
-class Inventory(dbus.service.Object):
+class Inventory(Openbmc.DbusProperties):
 	def __init__(self,bus,name):
 		dbus.service.Object.__init__(self,bus,name)
 		self.objects = [ ]
+		self.ObjectAdded(name,ENUM_INTF)		
 
 	def addItem(self,item):
 		self.objects.append(item)
@@ -47,13 +48,13 @@
 		dbus.service.Object.__init__(self,bus,name)
 
 		self.name = name
-
+		
 		## this will load properties from cache
 		PropertyCacher.load(name,INTF_NAME,self.properties)
 		data = {'is_fru': is_fru, 'fru_type': fru_type, 'present': 'Inactive', 'fault': 'None'}
 		self.SetMultiple(INTF_NAME,data)
-
-		
+		self.ObjectAdded(name,INTF_NAME)		
+		self.ObjectAdded(name,INTF_NAME)		
 		
 		
 	@dbus.service.method(INTF_NAME,
diff --git a/bin/sensor_manager.py b/bin/sensor_manager.py
index 9bb42d9..f1af961 100755
--- a/bin/sensor_manager.py
+++ b/bin/sensor_manager.py
@@ -17,7 +17,7 @@
 OBJ_NAME = '/org/openbmc/sensors'
 ENUM_INTF = 'org.openbmc.Object.Enumerate'
 
-class SensorManager(dbus.service.Object):
+class SensorManager(Openbmc.DbusProperties):
 	def __init__(self,bus,name):
 		dbus.service.Object.__init__(self,bus,name)
 		bus.add_signal_receiver(self.SensorChangedHandler,
@@ -37,6 +37,8 @@
 					signal_name = 'Critical', path_keyword='path')
 
 		self.sensor_cache = {}
+		self.ObjectAdded(name,DBUS_NAME);
+		self.ObjectAdded(name,ENUM_INTF);
 
 	@dbus.service.method(ENUM_INTF,
 		in_signature='', out_signature='a{sa{sv}}')
diff --git a/bin/sensors_virtual_p8.py b/bin/sensors_virtual_p8.py
index b3c975a..840ee04 100755
--- a/bin/sensors_virtual_p8.py
+++ b/bin/sensors_virtual_p8.py
@@ -16,6 +16,7 @@
 	def __init__(self):
 		Openbmc.DbusProperties.__init__(self)
 		self.Set(SensorValue.IFACE_NAME,'units',"")
+		self.ObjectAdded(name,SensorValue.IFACE_NAME)
 		
 	@dbus.service.method(IFACE_NAME,
 		in_signature='v', out_signature='')
diff --git a/bin/system_manager.py b/bin/system_manager.py
index 0ef92c4..086679f 100755
--- a/bin/system_manager.py
+++ b/bin/system_manager.py
@@ -8,9 +8,7 @@
 import dbus.mainloop.glib
 import os
 import time
-import json
-import xml.etree.ElementTree as ET
-
+import PropertyCacher
 import Openbmc
 
 if (len(sys.argv) < 2):
@@ -28,42 +26,13 @@
 INTF_ITEM = 'org.openbmc.InventoryItem'
 INTF_CONTROL = 'org.openbmc.Control'
 
-def get_objects(bus,bus_name,path,objects):
-	tmp_path = path
-	if (path == ""):
-		tmp_path="/"
-
-	obj = bus.get_object(bus_name,tmp_path)
-	introspect_iface = dbus.Interface(obj,"org.freedesktop.DBus.Introspectable")
- 	tree = ET.ElementTree(ET.fromstring(introspect_iface.Introspect()))
- 	root = tree.getroot()
-	parent = True
-	##print introspect_iface.Introspect()
-	for node in root.iter('node'):
-		for intf in node.iter('interface'):
-			objects[path] = True
-
-		if (node.attrib.has_key('name') == True):
-			node_name = node.attrib['name']
-			if (parent == False):
-				get_objects(bus,bus_name,path+"/"+node_name,objects)
-			else:
-				if (node_name != "" and node_name != path):
-					get_objects(bus,bus_name,node_name,objects)
-			
-		parent = False
-
-
-
 
 class SystemManager(dbus.service.Object):
 	def __init__(self,bus,name):
 		dbus.service.Object.__init__(self,bus,name)
 
-		## Signal handlers
-		bus.add_signal_receiver(self.NewBusHandler,
-					dbus_interface = 'org.freedesktop.DBus', 
-					signal_name = "NameOwnerChanged")
+		bus.add_signal_receiver(self.NewObjectHandler,
+			signal_name = "ObjectAdded", sender_keyword = 'bus_name')
 		bus.add_signal_receiver(self.SystemStateHandler,signal_name = "GotoSystemState")
 
 		self.current_state = ""
@@ -85,6 +54,11 @@
 				System.ID_LOOKUP[category][key] = new_val
 	
 		self.SystemStateHandler(System.SYSTEM_STATES[0])
+
+		if not os.path.exists(PropertyCacher.CACHE_PATH):
+			print "Creating cache directory: "+PropertyCacher.CACHE_PATH
+   			os.makedirs(PropertyCacher.CACHE_PATH)
+
 		print "SystemManager Init Done"
 
 
@@ -194,34 +168,26 @@
 	
 		return True
 
-	def NewBusHandler(self, bus_name, a, b):
-		if (len(b) > 0 and bus_name.find(Openbmc.BUS_PREFIX) == 0):
-			objects = {}
-			try:
-				get_objects(bus,bus_name,"",objects)
-				for obj_path in objects.keys():
-					self.bus_name_lookup[obj_path] = bus_name
-					print "New object: "+obj_path+" ("+bus_name+")"
-					if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
-						System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
-								
-			except Exception as e:
-				## object probably disappeared
-				#print e
-				pass
-	
+	def NewObjectHandler(self,obj_path, interface_name, bus_name = None):
+		if (self.bus_name_lookup.has_key(obj_path)):
+			if (self.bus_name_lookup[obj_path] == bus_name):
+				return
+		self.bus_name_lookup[obj_path] = bus_name
+		print "New object: "+obj_path+" ("+bus_name+")"
+		try:
+			if (System.EXIT_STATE_DEPEND[self.current_state].has_key(obj_path) == True):
+				System.EXIT_STATE_DEPEND[self.current_state][obj_path] = 1
 			## check if all required objects are started to move to next state
-			try:
-				state = 1
-				for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
-					if (System.EXIT_STATE_DEPEND[self.current_state][obj_path] == 0):
-						state = 0
-				## all required objects have started so go to next state
-				if (state == 1):
-					self.gotoNextState()
-			except:
-				pass
-
+			state = 1
+			for obj_path in System.EXIT_STATE_DEPEND[self.current_state]:
+				if (System.EXIT_STATE_DEPEND[self.current_state][obj_path] == 0):
+					state = 0
+			## all required objects have started so go to next state
+			if (state == 1):
+				print "All required objects started for "+self.current_state
+				self.gotoNextState()
+		except:
+			pass
 
 
 	@dbus.service.method(DBUS_NAME,
diff --git a/objects/fan_generic_obj.c b/objects/fan_generic_obj.c
index afe3318..fb61c5c 100644
--- a/objects/fan_generic_obj.c
+++ b/objects/fan_generic_obj.c
@@ -1,6 +1,6 @@
 #include "interfaces/openbmc_intf.h"

 #include "openbmc.h"

-

+#include "object_mapper.h"

 

 /* ---------------------------------------------------------------------------------------------------- */

 

@@ -66,6 +66,10 @@
   		object_skeleton_set_fan (object, fan);

   		g_object_unref (fan);

 		

+		ObjectMapper* mapper = object_mapper_skeleton_new ();

+		object_skeleton_set_object_mapper (object, mapper);

+		g_object_unref (mapper);

+	

   		//define method callbacks here

   		g_signal_connect (fan,

                     "handle-get-speed",

@@ -85,6 +89,7 @@
 

   /* Export all objects */

   g_dbus_object_manager_server_set_connection (manager, connection);

+  emit_object_added((GDBusObjectManager*)manager); 

 }

 

 static void

diff --git a/objects/flash_bios_obj.c b/objects/flash_bios_obj.c
index 4b82d67..738ba86 100644
--- a/objects/flash_bios_obj.c
+++ b/objects/flash_bios_obj.c
@@ -3,6 +3,7 @@
 #include <string.h>

 #include "interfaces/openbmc_intf.h"

 #include "openbmc.h"

+#include "object_mapper.h"

 

 /* ---------------------------------------------------------------------------------------------------- */

 static const gchar* dbus_object_path = "/org/openbmc/control/flash";

@@ -307,6 +308,10 @@
 		object_skeleton_set_shared_resource (object, lock);

  		g_object_unref (lock);

 

+		ObjectMapper* mapper = object_mapper_skeleton_new ();

+		object_skeleton_set_object_mapper (object, mapper);

+		g_object_unref (mapper);

+

 		shared_resource_set_lock(lock,false);

 		shared_resource_set_name(lock,"");

 

@@ -378,6 +383,7 @@
 	g_free(flasher_file);

 	/* Export all objects */

 	g_dbus_object_manager_server_set_connection (manager, connection);

+	emit_object_added((GDBusObjectManager*)manager); 

 }

 

 static void

diff --git a/objects/host_watchdog_obj.c b/objects/host_watchdog_obj.c
index 13208e2..a4651ea 100644
--- a/objects/host_watchdog_obj.c
+++ b/objects/host_watchdog_obj.c
@@ -1,6 +1,6 @@
 #include "interfaces/openbmc_intf.h"

 #include "openbmc.h"

-

+#include "object_mapper.h"

 

 /* ---------------------------------------------------------------------------------------------------- */

 

@@ -98,6 +98,10 @@
 		Watchdog *wd = watchdog_skeleton_new ();

   		object_skeleton_set_watchdog (object, wd);

   		g_object_unref (wd);

+

+		ObjectMapper* mapper = object_mapper_skeleton_new ();

+		object_skeleton_set_object_mapper (object, mapper);

+		g_object_unref (mapper);

 		

   		// set properties

   		watchdog_set_watchdog(wd,1);

@@ -129,6 +133,7 @@
 

   /* Export all objects */

   g_dbus_object_manager_server_set_connection (manager, connection);

+  emit_object_added((GDBusObjectManager*)manager); 

 }

 

 static void

diff --git a/objects/power_control_obj.c b/objects/power_control_obj.c
index 97d1021..5421074 100644
--- a/objects/power_control_obj.c
+++ b/objects/power_control_obj.c
@@ -10,6 +10,7 @@
 #include "interfaces/openbmc_intf.h"

 #include "openbmc.h"

 #include "gpio.h"

+#include "object_mapper.h"

 

 /* ---------------------------------------------------------------------------------------------------- */

 static const gchar* dbus_object_path = "/org/openbmc/control";

@@ -19,6 +20,9 @@
 //This object will use these GPIOs

 GPIO power_pin    = (GPIO){ "POWER_PIN" };

 GPIO pgood        = (GPIO){ "PGOOD" };

+GPIO usb_reset    = (GPIO){ "USB_RESET" };

+GPIO pcie_reset   = (GPIO){ "PCIE_RESET" };

+

 

 static GDBusObjectManagerServer *manager = NULL;

 

@@ -66,11 +70,26 @@
  			{

  				control_power_emit_power_lost(control_power);

 				control_emit_goto_system_state(control,"HOST_POWERED_OFF");

+				rc = gpio_open(&pcie_reset);

+				rc = gpio_write(&pcie_reset,0);

+				gpio_close(&pcie_reset);

+

+				rc = gpio_open(&usb_reset);

+				rc = gpio_write(&usb_reset,0);

+				gpio_close(&usb_reset);		

+

  			}

  			else

  			{

  				control_power_emit_power_good(control_power);

 				control_emit_goto_system_state(control,"HOST_POWERED_ON");

+				rc = gpio_open(&pcie_reset);

+				rc = gpio_write(&pcie_reset,1);

+				gpio_close(&pcie_reset);

+

+				rc = gpio_open(&usb_reset);

+				rc = gpio_write(&usb_reset,1);

+				gpio_close(&usb_reset);		

  			}

 		}

 	} else {

@@ -188,6 +207,10 @@
 	object_skeleton_set_control (object, control);

 	g_object_unref (control);

 

+	ObjectMapper* mapper = object_mapper_skeleton_new ();

+	object_skeleton_set_object_mapper (object, mapper);

+	g_object_unref (mapper);

+

 	//define method callbacks here

 	g_signal_connect (control_power,

        	            "handle-set-power-state",

@@ -219,6 +242,11 @@
 		if (rc != GPIO_OK) { break; }

 		rc = gpio_init(connection,&pgood);

 		if (rc != GPIO_OK) { break; }

+		rc = gpio_init(connection,&pcie_reset);

+		if (rc != GPIO_OK) { break; }

+		rc = gpio_init(connection,&usb_reset);

+		if (rc != GPIO_OK) { break; }

+

 		uint8_t gpio;

 		rc = gpio_open(&pgood);

 		if (rc != GPIO_OK) { break; }

@@ -227,6 +255,7 @@
 		gpio_close(&pgood);	

 		control_power_set_pgood(control_power,gpio);

 		printf("Pgood state: %d\n",gpio);

+

 	} while(0);

 	if (rc != GPIO_OK)

 	{

@@ -243,7 +272,7 @@
 		control_power_set_pgood_timeout(control_power,pgood_timeout);

 		g_timeout_add(poll_interval, poll_pgood, object);

 	}

- 

+	emit_object_added((GDBusObjectManager*)manager);  

 }

 

 static void