Esempio n. 1
0
	def NewBusHandler(self, bus_name, a, b):
		if (len(b) > 0 and bus_name.find(Openbmc.BUS_PREFIX) == 0):
			objects = {}
			try:
				Openbmc.get_objs(bus,bus_name,"",objects)
				for instance_name in objects.keys():
					obj_path = objects[instance_name]['PATH']
					#obj = bus.get_object("org.openbmc.managers.Property",
					#		"/org/openbmc/managers/Property")
					#intf = dbus.Interface(obj,"org.openbmc.managers.Property")
					#intf.loadFromCache(bus_name,obj_path)
					self.bus_name_lookup[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:
				pass
	
			if (System.SYSTEM_CONFIG.has_key(bus_name)):
				for instance_name in objects.keys(): 
					obj_path = objects[instance_name]['PATH']
					for instance in System.SYSTEM_CONFIG[bus_name]['instances']:
						if (instance.has_key('properties') and instance['name'] == instance_name):
							props = instance['properties']
							print "Load Properties: "+obj_path
							self.property_manager.loadProperties(bus_name,obj_path,props)
					## If object has an init method, call it
					for init_intf in objects[instance_name]['INIT']:
						obj = bus.get_object(bus_name,obj_path)
						intf = dbus.Interface(obj,init_intf)
						print "Calling init method: " +obj_path+" : "+init_intf
						intf.init()

			## check if all 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
Esempio n. 2
0
	def NewBusHandler(self, bus_name, a, b):
		if (len(b) > 0 and bus_name.find(Openbmc.BUS_PREFIX) == 0):
			objects = {}
			Openbmc.get_objs(bus,bus_name,"",objects)
			for instance_name in objects.keys():
				self.bus_name_lookup[objects[instance_name]['PATH']] = bus_name
			
			if (System.SYSTEM_CONFIG.has_key(bus_name)):
				System.SYSTEM_CONFIG[bus_name]['heartbeat_count'] = 0
				for instance_name in objects.keys(): 
					obj_path = objects[instance_name]['PATH']
					for instance in System.SYSTEM_CONFIG[bus_name]['instances']:
						if (instance.has_key('properties') and instance['name'] == instance_name):
							props = instance['properties']
							print "Load Properties: "+obj_path
							self.property_manager.loadProperties(bus_name,obj_path,props)
					## If object has an init method, call it
					for init_intf in objects[instance_name]['INIT']:
						obj = bus.get_object(bus_name,obj_path)
						intf = dbus.Interface(obj,init_intf)
						print "Calling init method: " +obj_path+" : "+init_intf
						intf.init()