merge
diff --git a/Makefile b/Makefile
index cbb62d8..54190f6 100644
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@
%.o: objects/pflash/libflash/%.c
$(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
-all: setup libopenbmc_intf power_control led_controller button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher control_bmc_barreleye
+all: setup libopenbmc_intf power_control led_controller button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher control_bmc_barreleye pflash
setup:
mkdir -p obj lib
@@ -33,26 +33,26 @@
libopenbmc_intf: openbmc_intf.o
$(CC) -shared -o lib/$@.so obj/openbmc_intf.o $(LDFLAGS)
-power_control: power_control_obj.o gpio.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(LDFLAGS) $(LIBS)
+power_control: power_control_obj.o gpio.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-led_controller: led_controller.o gpio.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o $(LDFLAGS) $(LIBS)
+led_controller: led_controller.o gpio.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-button_power: button_power_obj.o gpio.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
+button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-control_host: control_host_obj.o gpio.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(LDFLAGS) $(LIBS)
+control_host: control_host_obj.o gpio.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-flash_bios: flash_bios_obj.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/flash_bios_obj.o $(LDFLAGS) $(LIBS)
+flash_bios: flash_bios_obj.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/flash_bios_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-fan: fan_generic_obj.o gpio.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/gpio.o obj/fan_generic_obj.o $(LDFLAGS) $(LIBS)
+fan: fan_generic_obj.o gpio.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/gpio.o obj/fan_generic_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
-host_watchdog: host_watchdog_obj.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/host_watchdog_obj.o $(LDFLAGS) $(LIBS)
+host_watchdog: host_watchdog_obj.o object_mapper.o libopenbmc_intf
+ $(CC) -o bin/$@.exe obj/host_watchdog_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
control_bmc: control_bmc_obj.o libopenbmc_intf
$(CC) -o bin/$@.exe obj/control_bmc_obj.o $(LDFLAGS) $(LIBS)
@@ -69,7 +69,6 @@
flasher: $(OBJS2) flasher_obj.o libopenbmc_intf
$(CC) -o bin/$@.exe obj/flasher_obj.o $(OBJS3) $(LDFLAGS) $(LIBS)
-hwmon: hwmon_intf.o libopenbmc_intf
- $(CC) -o bin/$@.exe obj/hwmon_intf.o $(LDFLAGS) $(LIBS)
-
+pflash: $(OBJS2) pflash.o
+ $(CC) -o bin/$@ obj/pflash.o $(OBJS3) $(LDFLAGS)
diff --git a/bin/Barreleye.py b/bin/Barreleye.py
index b894fe4..e4c4b8a 100755
--- a/bin/Barreleye.py
+++ b/bin/Barreleye.py
@@ -60,13 +60,6 @@
}
APPS = {
- 'property_manager' : {
- 'system_state' : 'BASE_APPS',
- 'start_process' : False,
- 'monitor_process' : False,
- 'process_name' : 'property_manager.py',
- 'args' : [ SYSTEM_NAME ]
- },
'bmc_init' : {
'system_state' : 'BMC_INIT',
'start_process' : True,
@@ -324,6 +317,8 @@
GPIO_CONFIG['IDENTIFY'] = { 'gpio_pin': 'R5', 'direction': 'out' }
GPIO_CONFIG['BMC_READY'] = { 'gpio_pin': 'H2', 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' }
+GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
+GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_pin': 'N0', 'direction': 'in' }
GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_pin': 'N1', 'direction': 'in' }
GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_pin': 'N2', 'direction': 'in' }
diff --git a/bin/Openbmc.py b/bin/Openbmc.py
index da4ecff..b370d8b 100755
--- a/bin/Openbmc.py
+++ b/bin/Openbmc.py
@@ -1,5 +1,4 @@
import dbus
-import xml.etree.ElementTree as ET
BUS_PREFIX = 'org.openbmc'
OBJ_PREFIX = "/org/openbmc"
@@ -11,24 +10,6 @@
['NOT_SET','NORMAL','LOWER_CRITICAL','LOWER_WARNING','UPPER_WARNING','UPPER_CRITICAL'],
}
-DBUS_TO_BASE_TYPES = {
- 'dbus.Byte' : 'int',
- 'dbus.Double' : 'float',
- 'dbus.Int32' : 'int',
- 'dbus.UInt32' : 'long',
- 'dbus.String' : 'str',
- 'dbus.UInt64' : 'long',
- 'dbus.Boolean' : 'bool',
-}
-
-BASE_TO_DBUS_TYPES = {
- 'int' : 'dbus.Int32',
- 'float' : 'dbus.Double',
- 'str' : 'dbus.String',
- 'long' : 'dbus.Int64',
- 'bool' : 'dbus.Boolean'
-}
-
def getSystemName():
#use filename as system name, strip off path and ext
parts = __file__.replace('.pyc','').replace('.py','').split('/')
@@ -51,39 +32,6 @@
return dbus.Interface(obj,bus_name)
-def get_objs(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
- for node in root.iter('node'):
- for intf in node.iter('interface'):
- intf_name = intf.attrib['name']
- parts=path.split('/')
- instance = parts[len(parts)-1]
- if (objects.has_key(instance) == False):
- objects[instance] = {}
- objects[instance]['PATH'] = path
- objects[instance]['INIT'] = []
- for method in intf.iter('method'):
- if (method.attrib['name'] == "init"):
- objects[instance]['INIT'].append(intf_name)
-
- if (node.attrib.has_key('name') == True):
- node_name = node.attrib['name']
- if (parent == False):
- get_objs(bus,bus_name,path+"/"+node_name,objects)
- else:
- if (node_name != "" and node_name != path):
- get_objs(bus,bus_name,node_name,objects)
-
- parent = False
-
class DbusProperties(dbus.service.Object):
def __init__(self):
dbus.service.Object.__init__(self)
@@ -153,42 +101,10 @@
invalidated_properties):
pass
+ @dbus.service.signal("org.openbmc.Object.ObjectMapper",
+ signature='ss')
+ def ObjectAdded(self,object_path,interface_name):
+ pass
-class DbusVariable:
- def __init__(self,name,value):
- self.name = str(name)
- self.dbusType = str(type(value)).split("'")[1]
- self.variant_level = 2
- self.value = None
- if (BASE_TO_DBUS_TYPES.has_key(self.dbusType) == False):
- self.variant_level = value.variant_level
- try:
- self.value = eval(DBUS_TO_BASE_TYPES[self.dbusType]+"(value)")
- except:
- raise Exception("Unknown dbus type: "+self.dbusType)
- else:
- self.dbusType = BASE_TO_DBUS_TYPES[self.dbusType]
- self.value = value
- def setValue(self,value):
- try:
- self.value = eval(DBUS_TO_BASE_TYPES[self.dbusType]+"(value)")
- except:
- raise Exception("Unknown dbus type: "+self.dbusType)
-
- def setVariant(self,variant_level):
- self.variant_level = variant_level
-
- def getName(self):
- return self.name
-
- def getValue(self):
- e = self.dbusType+"(self.value, variant_level="+str(self.variant_level)+")"
- return eval(e)
-
- def getBaseValue(self):
- return self.value
-
- def __str__(self):
- return self.dbusType+":"+str(self.value)
diff --git a/bin/Palmetto.py b/bin/Palmetto.py
index 3c223e9..bef25c5 100755
--- a/bin/Palmetto.py
+++ b/bin/Palmetto.py
@@ -60,13 +60,6 @@
}
APPS = {
- 'property_manager' : {
- 'system_state' : 'BASE_APPS',
- 'start_process' : False,
- 'monitor_process' : False,
- 'process_name' : 'property_manager.py',
- 'args' : [ SYSTEM_NAME ]
- },
'bmc_init' : {
'system_state' : 'BMC_INIT',
'start_process' : True,
@@ -267,6 +260,8 @@
GPIO_CONFIG['IDENTIFY'] = { 'gpio_pin': 'R4', 'direction': 'out' }
GPIO_CONFIG['BMC_READY'] = { 'gpio_pin': 'R4', 'direction': 'out' }
GPIO_CONFIG['POWER_BUTTON'] = { 'gpio_pin': 'E0', 'direction': 'both' }
+GPIO_CONFIG['PCIE_RESET'] = { 'gpio_pin': 'B5', 'direction': 'out' }
+GPIO_CONFIG['USB_RESET'] = { 'gpio_pin': 'B6', 'direction': 'out' }
GPIO_CONFIG['SLOT0_RISER_PRESENT'] = { 'gpio_pin': 'N0', 'direction': 'in' }
GPIO_CONFIG['SLOT1_RISER_PRESENT'] = { 'gpio_pin': 'N1', 'direction': 'in' }
GPIO_CONFIG['SLOT2_RISER_PRESENT'] = { 'gpio_pin': 'N2', 'direction': 'in' }
diff --git a/bin/PropertyCacher.py b/bin/PropertyCacher.py
index 3b0002f..b10edcb 100644
--- a/bin/PropertyCacher.py
+++ b/bin/PropertyCacher.py
@@ -1,5 +1,6 @@
import os
import cPickle
+import json
import Openbmc
CACHE_PATH = '/var/cache/obmc/'
@@ -12,19 +13,21 @@
def save(obj_path, iface_name, properties):
print "Caching: "+obj_path
try:
- output = open(getCacheFilename(obj_path, iface_name), 'wb')
- ## save properties
- dbus_props = {}
+
+ filename = getCacheFilename(obj_path, iface_name)
+ output = open(filename, 'wb')
+ try:
+ ## use json module to convert dbus datatypes
+ props = json.dumps(properties[iface_name])
+ prop_obj = json.loads(props)
+ cPickle.dump(prop_obj,output)
+ except Exception as e:
+ print "ERROR: "+str(e)
+ finally:
+ output.close()
+ except:
+ print "ERROR opening cache file: "+filename
- for p in properties[iface_name].keys():
- dbus_prop = Openbmc.DbusVariable(p,properties[iface_name][p])
- dbus_props[str(p)] = dbus_prop.getBaseValue()
-
- cPickle.dump(dbus_props,output)
- except Exception as e:
- print "ERROR: "+str(e)
- finally:
- output.close()
def load(obj_path, iface_name, properties):
## overlay with pickled data
diff --git a/bin/PropertyManager.py b/bin/PropertyManager.py
deleted file mode 100755
index 1fa8d87..0000000
--- a/bin/PropertyManager.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env python
-
-import sys
-import cPickle
-import os
-import Openbmc
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-#from gi.repository import Gio, GLib, GObject
-import gobject
-
-
-class PropertyManager():
- def __init__(self,bus,save_path):
- self.bus = bus
- self.save_path = save_path
-
- def loadProperties(self,bus_name,obj_path,properties):
- ## Load properties from system config
- obj = self.bus.get_object(bus_name,obj_path)
- dbus_properties = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
- for prop_interface in properties.keys():
- for prop in properties[prop_interface]:
- tmp_val = dbus_properties.Get(prop_interface,prop)
- dbus_prop = Openbmc.DbusVariable(prop,tmp_val)
- value = properties[prop_interface][prop]
- dbus_prop.setValue(value)
- dbus_properties.Set(prop_interface,prop,dbus_prop.getValue())
-
- ## if save file exists, overlay properties from file
- directory = obj_path.replace('/','.')
- directory = self.save_path+directory.lstrip('.')
- filename = directory+"/"+prop_interface
- if (os.path.isfile(filename) == False):
- pass
- ## not an error
- #print "No cache available for: "+filename
- else:
- try:
- print "Loading from disk: "+obj_path
- output = open(filename, 'rb')
- dbus_props = cPickle.load(output)
- output.close()
- save_properties = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
- for dbus_prop in dbus_props:
- save_properties.Set(prop_interface,dbus_prop.getName(),dbus_prop.getValue())
-
- except Exception as e:
- ## TODO: Error handling
- print "Error loadFru: "+str(e)
-
- return None
-
- def saveProperties(self,bus_name,obj_path,interface_name,cache,properties):
- obj = self.bus.get_object(bus_name,obj_path)
- prop_intf = dbus.Interface(obj, 'org.freedesktop.DBus.Properties')
-
- for prop in properties.keys():
- print "Saving properties: "+prop
- ## convert property to correct dbus type
- prop_intf.Set(interface_name,prop,properties[prop])
-
- dbus_props = []
- if (cache):
- print "Caching: "+obj_path
- all_properties = prop_intf.GetAll(interface_name)
- for prop in all_properties.keys():
- dbus_prop = Openbmc.DbusVariable(prop,all_properties[prop])
- dbus_props.append(dbus_prop)
-
- try:
- directory = obj_path.replace('/','.')
- directory = self.save_path+directory.lstrip('.')
- filename = directory+"/"+interface_name
- if not os.path.exists(directory):
- os.makedirs(directory)
-
- output = open(filename, 'wb')
- cPickle.dump(dbus_props,output)
- output.close()
- except Exception as e:
- ## TODO: error handling
- print str(e)
-
- return None
-
-
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/property_manager.py b/bin/property_manager.py
deleted file mode 100755
index 108f81c..0000000
--- a/bin/property_manager.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/python -u
-
-import sys
-#from gi.repository import GObject
-import gobject
-import dbus
-import dbus.service
-import dbus.mainloop.glib
-import cPickle
-import glob
-import os
-
-if (len(sys.argv) < 2):
- print "Usage: property_manager.py [system name]"
- exit(1)
-System = __import__(sys.argv[1])
-import Openbmc
-
-DBUS_NAME = 'org.openbmc.managers.Property'
-OBJ_NAME = '/org/openbmc/managers/Property'
-INTF_NAME = 'org.openbmc.managers.Property'
-
-class PropertyManager(dbus.service.Object):
- def __init__(self,bus,name):
- dbus.service.Object.__init__(self,bus,name)
- if not os.path.exists(System.CACHE_PATH):
- os.makedirs(System.CACHE_PATH)
-
-
- bus.add_signal_receiver(self.PropertyChangedHandler,
- dbus_interface = 'org.freedesktop.DBus.Properties',
- signal_name = 'PropertiesChanged', sender_keyword='bus_name', path_keyword='path')
-
- bus.add_signal_receiver(self.RegisterPersistantInterface,
- dbus_interface = 'org.openbmc.PersistantInterface',
- signal_name = 'Register', sender_keyword='bus_name', path_keyword='path')
-
- self.registered_interfaces = {}
-
-
- def RegisterPersistantInterface(self,interface_name, bus_name = None, path = None):
- interface_name = str(interface_name)
- print "Registering cached object (interface): "+path+" ("+interface_name+")"
- self.registered_interfaces[interface_name] = True
- self.loadFromCache(bus_name,path,interface_name)
-
-
- def PropertyChangedHandler(self, interface_name, changed_properties,
- invalidated_properties, bus_name = None, path = None):
- ## TODO: just save all properties, probably should journal changes instead
- if (self.registered_interfaces.has_key(interface_name)):
- self.saveToCache(bus_name,path,interface_name)
-
- def getCacheFilename(self,obj_path,intf_name):
- name = obj_path.replace('/','.')
- filename = System.CACHE_PATH+name[1:]+"@"+intf_name+".props"
- return filename
-
- def saveToCache(self, bus_name, object_path, interface_name):
- print "Caching: "+object_path
- try:
- obj = bus.get_object(bus_name,object_path)
- intf = dbus.Interface(obj,"org.freedesktop.DBus.Properties")
- props = intf.GetAll(interface_name)
- output = open(self.getCacheFilename(object_path,interface_name), 'wb')
- ## save properties
- dbus_props = {}
- for p in props.keys():
- dbus_prop = Openbmc.DbusVariable(p,props[p])
- dbus_props[str(p)] = dbus_prop.getBaseValue()
- cPickle.dump(dbus_props,output)
- except Exception as e:
- print "ERROR: "+str(e)
- finally:
- output.close()
-
- def loadFromCache(self,bus_name, object_path, interface_name):
- ## overlay with pickled data
- filename=self.getCacheFilename(object_path,interface_name)
- if (os.path.isfile(filename)):
- print "Loading from cache: "+filename
- try:
- p = open(filename, 'rb')
- data = cPickle.load(p)
- obj = bus.get_object(bus_name,object_path)
- ## TODO: don't use exception to determine whether interface is implemented
- try:
- intf = dbus.Interface(obj,"org.openbmc.Object.Properties")
- props = intf.SetMultiple(interface_name,data)
- except TypeError as t:
- print "SetMultiple interface doesn't exist, doing 1 set a time"
- intf = dbus.Interface(obj,dbus.PROPERTIES_IFACE)
- for prop in data:
- intf.Set(interface_name,prop,data[prop])
-
-
- except Exception as e:
- print "ERROR: Loading cache file: " +str(e)
- finally:
- p.close()
-
-
-if __name__ == '__main__':
- dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- bus = Openbmc.getDBus()
- name = dbus.service.BusName(DBUS_NAME,bus)
- obj = PropertyManager(bus,OBJ_NAME)
- mainloop = gobject.MainLoop()
-
- print "Running Property Manager"
- mainloop.run()
-
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/includes/gpio.h b/includes/gpio.h
index 6983e77..8cfc59f 100644
--- a/includes/gpio.h
+++ b/includes/gpio.h
@@ -16,13 +16,13 @@
//gpio functions
-#define GPIO_OK 0
-#define GPIO_ERROR -1
-#define GPIO_OPEN_ERROR -2
-#define GPIO_INIT_ERROR -3
-#define GPIO_READ_ERROR -4
-#define GPIO_WRITE_ERROR -5
-#define GPIO_LOOKUP_ERROR -6
+#define GPIO_OK 0x00
+#define GPIO_ERROR 0x01
+#define GPIO_OPEN_ERROR 0x02
+#define GPIO_INIT_ERROR 0x04
+#define GPIO_READ_ERROR 0x08
+#define GPIO_WRITE_ERROR 0x10
+#define GPIO_LOOKUP_ERROR 0x20
int gpio_init(GDBusConnection*, GPIO*);
void gpio_close(GPIO*);
diff --git a/includes/object_mapper.c b/includes/object_mapper.c
new file mode 100644
index 0000000..1164251
--- /dev/null
+++ b/includes/object_mapper.c
@@ -0,0 +1,31 @@
+#include "object_mapper.h"
+
+
+void
+emit_object_added(GDBusObjectManager *manager)
+{
+ GList *objects;
+ GList *l;
+
+ objects = g_dbus_object_manager_get_objects(manager);
+ for (l = objects; l != NULL; l = l->next)
+ {
+ GDBusObject *object = l->data;
+ ObjectMapper* map = object_get_object_mapper((Object*)object);
+
+ GList *interfaces;
+ GList *ll;
+ const gchar *object_path = g_dbus_object_get_object_path(G_DBUS_OBJECT(object));
+
+ interfaces = g_dbus_object_get_interfaces(G_DBUS_OBJECT(object));
+ for (ll = interfaces; ll != NULL; ll = ll->next)
+ {
+ GDBusInterface *interface = G_DBUS_INTERFACE(ll->data);
+ object_mapper_emit_object_added(map,object_path,
+ g_dbus_interface_get_info(interface)->name);
+ }
+ g_list_free_full(interfaces, g_object_unref);
+ }
+ g_list_free_full(objects, g_object_unref);
+}
+
diff --git a/includes/object_mapper.h b/includes/object_mapper.h
new file mode 100644
index 0000000..b0a97a7
--- /dev/null
+++ b/includes/object_mapper.h
@@ -0,0 +1,10 @@
+#ifndef __OBJECTMAPPER2_H__
+#define __OBJECTMAPPER2_H__
+
+#include "interfaces/openbmc_intf.h"
+
+
+void emit_object_added(GDBusObjectManager*);
+
+
+#endif
diff --git a/interfaces/openbmc_intf.c b/interfaces/openbmc_intf.c
index b7d9501..c9ce587 100644
--- a/interfaces/openbmc_intf.c
+++ b/interfaces/openbmc_intf.c
@@ -149,6 +149,828 @@
}
/* ------------------------------------------------------------------------
+ * Code for interface org.openbmc.Object.Mapper
+ * ------------------------------------------------------------------------
+ */
+
+/**
+ * SECTION:ObjectMapper
+ * @title: ObjectMapper
+ * @short_description: Generated C code for the org.openbmc.Object.Mapper D-Bus interface
+ *
+ * This section contains code for working with the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface in C.
+ */
+
+/* ---- Introspection data for org.openbmc.Object.Mapper ---- */
+
+static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_object_path =
+{
+ {
+ -1,
+ (gchar *) "object_path",
+ (gchar *) "s",
+ NULL
+ },
+ FALSE
+};
+
+static const _ExtendedGDBusArgInfo _object_mapper_signal_info_object_added_ARG_interface_name =
+{
+ {
+ -1,
+ (gchar *) "interface_name",
+ (gchar *) "s",
+ NULL
+ },
+ FALSE
+};
+
+static const _ExtendedGDBusArgInfo * const _object_mapper_signal_info_object_added_ARG_pointers[] =
+{
+ &_object_mapper_signal_info_object_added_ARG_object_path,
+ &_object_mapper_signal_info_object_added_ARG_interface_name,
+ NULL
+};
+
+static const _ExtendedGDBusSignalInfo _object_mapper_signal_info_object_added =
+{
+ {
+ -1,
+ (gchar *) "ObjectAdded",
+ (GDBusArgInfo **) &_object_mapper_signal_info_object_added_ARG_pointers,
+ NULL
+ },
+ "object-added"
+};
+
+static const _ExtendedGDBusSignalInfo * const _object_mapper_signal_info_pointers[] =
+{
+ &_object_mapper_signal_info_object_added,
+ NULL
+};
+
+static const _ExtendedGDBusInterfaceInfo _object_mapper_interface_info =
+{
+ {
+ -1,
+ (gchar *) "org.openbmc.Object.Mapper",
+ NULL,
+ (GDBusSignalInfo **) &_object_mapper_signal_info_pointers,
+ NULL,
+ NULL
+ },
+ "object-mapper",
+};
+
+
+/**
+ * object_mapper_interface_info:
+ *
+ * Gets a machine-readable description of the <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> D-Bus interface.
+ *
+ * Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
+ */
+GDBusInterfaceInfo *
+object_mapper_interface_info (void)
+{
+ return (GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct;
+}
+
+/**
+ * object_mapper_override_properties:
+ * @klass: The class structure for a #GObject<!-- -->-derived class.
+ * @property_id_begin: The property id to assign to the first overridden property.
+ *
+ * Overrides all #GObject properties in the #ObjectMapper interface for a concrete class.
+ * The properties are overridden in the order they are defined.
+ *
+ * Returns: The last property id.
+ */
+guint
+object_mapper_override_properties (GObjectClass *klass, guint property_id_begin)
+{
+ return property_id_begin - 1;
+}
+
+
+
+/**
+ * ObjectMapper:
+ *
+ * Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
+ */
+
+/**
+ * ObjectMapperIface:
+ * @parent_iface: The parent interface.
+ * @object_added: Handler for the #ObjectMapper::object-added signal.
+ *
+ * Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
+ */
+
+typedef ObjectMapperIface ObjectMapperInterface;
+G_DEFINE_INTERFACE (ObjectMapper, object_mapper, G_TYPE_OBJECT);
+
+static void
+object_mapper_default_init (ObjectMapperIface *iface)
+{
+ /* GObject signals for received D-Bus signals: */
+ /**
+ * ObjectMapper::object-added:
+ * @object: A #ObjectMapper.
+ * @arg_object_path: Argument.
+ * @arg_interface_name: Argument.
+ *
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> is received.
+ *
+ * On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
+ */
+ g_signal_new ("object-added",
+ G_TYPE_FROM_INTERFACE (iface),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ObjectMapperIface, object_added),
+ NULL,
+ NULL,
+ g_cclosure_marshal_generic,
+ G_TYPE_NONE,
+ 2, G_TYPE_STRING, G_TYPE_STRING);
+
+}
+
+/**
+ * object_mapper_emit_object_added:
+ * @object: A #ObjectMapper.
+ * @arg_object_path: Argument to pass with the signal.
+ * @arg_interface_name: Argument to pass with the signal.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Object-Mapper.ObjectAdded">"ObjectAdded"</link> D-Bus signal.
+ */
+void
+object_mapper_emit_object_added (
+ ObjectMapper *object,
+ const gchar *arg_object_path,
+ const gchar *arg_interface_name)
+{
+ g_signal_emit_by_name (object, "object-added", arg_object_path, arg_interface_name);
+}
+
+/* ------------------------------------------------------------------------ */
+
+/**
+ * ObjectMapperProxy:
+ *
+ * The #ObjectMapperProxy structure contains only private data and should only be accessed using the provided API.
+ */
+
+/**
+ * ObjectMapperProxyClass:
+ * @parent_class: The parent class.
+ *
+ * Class structure for #ObjectMapperProxy.
+ */
+
+struct _ObjectMapperProxyPrivate
+{
+ GData *qdata;
+};
+
+static void object_mapper_proxy_iface_init (ObjectMapperIface *iface);
+
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY,
+ G_ADD_PRIVATE (ObjectMapperProxy)
+ G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init));
+
+#else
+G_DEFINE_TYPE_WITH_CODE (ObjectMapperProxy, object_mapper_proxy, G_TYPE_DBUS_PROXY,
+ G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_proxy_iface_init));
+
+#endif
+static void
+object_mapper_proxy_finalize (GObject *object)
+{
+ ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (object);
+ g_datalist_clear (&proxy->priv->qdata);
+ G_OBJECT_CLASS (object_mapper_proxy_parent_class)->finalize (object);
+}
+
+static void
+object_mapper_proxy_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+}
+
+static void
+object_mapper_proxy_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+}
+
+static void
+object_mapper_proxy_g_signal (GDBusProxy *proxy,
+ const gchar *sender_name G_GNUC_UNUSED,
+ const gchar *signal_name,
+ GVariant *parameters)
+{
+ _ExtendedGDBusSignalInfo *info;
+ GVariantIter iter;
+ GVariant *child;
+ GValue *paramv;
+ guint num_params;
+ guint n;
+ guint signal_id;
+ info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, signal_name);
+ if (info == NULL)
+ return;
+ num_params = g_variant_n_children (parameters);
+ paramv = g_new0 (GValue, num_params + 1);
+ g_value_init (¶mv[0], TYPE_OBJECT_MAPPER);
+ g_value_set_object (¶mv[0], proxy);
+ g_variant_iter_init (&iter, parameters);
+ n = 1;
+ while ((child = g_variant_iter_next_value (&iter)) != NULL)
+ {
+ _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
+ if (arg_info->use_gvariant)
+ {
+ g_value_init (¶mv[n], G_TYPE_VARIANT);
+ g_value_set_variant (¶mv[n], child);
+ n++;
+ }
+ else
+ g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
+ g_variant_unref (child);
+ }
+ signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER);
+ g_signal_emitv (paramv, signal_id, 0, NULL);
+ for (n = 0; n < num_params + 1; n++)
+ g_value_unset (¶mv[n]);
+ g_free (paramv);
+}
+
+static void
+object_mapper_proxy_g_properties_changed (GDBusProxy *_proxy,
+ GVariant *changed_properties,
+ const gchar *const *invalidated_properties)
+{
+ ObjectMapperProxy *proxy = OBJECT_MAPPER_PROXY (_proxy);
+ guint n;
+ const gchar *key;
+ GVariantIter *iter;
+ _ExtendedGDBusPropertyInfo *info;
+ g_variant_get (changed_properties, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
+ {
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, key);
+ g_datalist_remove_data (&proxy->priv->qdata, key);
+ if (info != NULL)
+ g_object_notify (G_OBJECT (proxy), info->hyphen_name);
+ }
+ g_variant_iter_free (iter);
+ for (n = 0; invalidated_properties[n] != NULL; n++)
+ {
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, invalidated_properties[n]);
+ g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
+ if (info != NULL)
+ g_object_notify (G_OBJECT (proxy), info->hyphen_name);
+ }
+}
+
+static void
+object_mapper_proxy_init (ObjectMapperProxy *proxy)
+{
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+ proxy->priv = object_mapper_proxy_get_instance_private (proxy);
+#else
+ proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxyPrivate);
+#endif
+
+ g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), object_mapper_interface_info ());
+}
+
+static void
+object_mapper_proxy_class_init (ObjectMapperProxyClass *klass)
+{
+ GObjectClass *gobject_class;
+ GDBusProxyClass *proxy_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = object_mapper_proxy_finalize;
+ gobject_class->get_property = object_mapper_proxy_get_property;
+ gobject_class->set_property = object_mapper_proxy_set_property;
+
+ proxy_class = G_DBUS_PROXY_CLASS (klass);
+ proxy_class->g_signal = object_mapper_proxy_g_signal;
+ proxy_class->g_properties_changed = object_mapper_proxy_g_properties_changed;
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
+ g_type_class_add_private (klass, sizeof (ObjectMapperProxyPrivate));
+#endif
+}
+
+static void
+object_mapper_proxy_iface_init (ObjectMapperIface *iface)
+{
+}
+
+/**
+ * object_mapper_proxy_new:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new() for more details.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call object_mapper_proxy_new_finish() to get the result of the operation.
+ *
+ * See object_mapper_proxy_new_sync() for the synchronous, blocking version of this constructor.
+ */
+void
+object_mapper_proxy_new (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (TYPE_OBJECT_MAPPER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
+}
+
+/**
+ * object_mapper_proxy_new_finish:
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new().
+ * @error: Return location for error or %NULL
+ *
+ * Finishes an operation started with object_mapper_proxy_new().
+ *
+ * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
+ */
+ObjectMapper *
+object_mapper_proxy_new_finish (
+ GAsyncResult *res,
+ GError **error)
+{
+ GObject *ret;
+ GObject *source_object;
+ source_object = g_async_result_get_source_object (res);
+ ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
+ g_object_unref (source_object);
+ if (ret != NULL)
+ return OBJECT_MAPPER (ret);
+ else
+ return NULL;
+}
+
+/**
+ * object_mapper_proxy_new_sync:
+ * @connection: A #GDBusConnection.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: (allow-none): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
+ * @object_path: An object path.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL
+ *
+ * Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>. See g_dbus_proxy_new_sync() for more details.
+ *
+ * The calling thread is blocked until a reply is received.
+ *
+ * See object_mapper_proxy_new() for the asynchronous version of this constructor.
+ *
+ * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
+ */
+ObjectMapper *
+object_mapper_proxy_new_sync (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GInitable *ret;
+ ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
+ if (ret != NULL)
+ return OBJECT_MAPPER (ret);
+ else
+ return NULL;
+}
+
+
+/**
+ * object_mapper_proxy_new_for_bus:
+ * @bus_type: A #GBusType.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
+ * @user_data: User data to pass to @callback.
+ *
+ * Like object_mapper_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
+ *
+ * When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
+ * You can then call object_mapper_proxy_new_for_bus_finish() to get the result of the operation.
+ *
+ * See object_mapper_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
+ */
+void
+object_mapper_proxy_new_for_bus (
+ GBusType bus_type,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ g_async_initable_new_async (TYPE_OBJECT_MAPPER_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
+}
+
+/**
+ * object_mapper_proxy_new_for_bus_finish:
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to object_mapper_proxy_new_for_bus().
+ * @error: Return location for error or %NULL
+ *
+ * Finishes an operation started with object_mapper_proxy_new_for_bus().
+ *
+ * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
+ */
+ObjectMapper *
+object_mapper_proxy_new_for_bus_finish (
+ GAsyncResult *res,
+ GError **error)
+{
+ GObject *ret;
+ GObject *source_object;
+ source_object = g_async_result_get_source_object (res);
+ ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
+ g_object_unref (source_object);
+ if (ret != NULL)
+ return OBJECT_MAPPER (ret);
+ else
+ return NULL;
+}
+
+/**
+ * object_mapper_proxy_new_for_bus_sync:
+ * @bus_type: A #GBusType.
+ * @flags: Flags from the #GDBusProxyFlags enumeration.
+ * @name: A bus name (well-known or unique).
+ * @object_path: An object path.
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL
+ *
+ * Like object_mapper_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
+ *
+ * The calling thread is blocked until a reply is received.
+ *
+ * See object_mapper_proxy_new_for_bus() for the asynchronous version of this constructor.
+ *
+ * Returns: (transfer full) (type ObjectMapperProxy): The constructed proxy object or %NULL if @error is set.
+ */
+ObjectMapper *
+object_mapper_proxy_new_for_bus_sync (
+ GBusType bus_type,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GInitable *ret;
+ ret = g_initable_new (TYPE_OBJECT_MAPPER_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.openbmc.Object.Mapper", NULL);
+ if (ret != NULL)
+ return OBJECT_MAPPER (ret);
+ else
+ return NULL;
+}
+
+
+/* ------------------------------------------------------------------------ */
+
+/**
+ * ObjectMapperSkeleton:
+ *
+ * The #ObjectMapperSkeleton structure contains only private data and should only be accessed using the provided API.
+ */
+
+/**
+ * ObjectMapperSkeletonClass:
+ * @parent_class: The parent class.
+ *
+ * Class structure for #ObjectMapperSkeleton.
+ */
+
+struct _ObjectMapperSkeletonPrivate
+{
+ GValue *properties;
+ GList *changed_properties;
+ GSource *changed_properties_idle_source;
+ GMainContext *context;
+ GMutex lock;
+};
+
+static void
+_object_mapper_skeleton_handle_method_call (
+ GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *sender G_GNUC_UNUSED,
+ const gchar *object_path G_GNUC_UNUSED,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
+ _ExtendedGDBusMethodInfo *info;
+ GVariantIter iter;
+ GVariant *child;
+ GValue *paramv;
+ guint num_params;
+ guint num_extra;
+ guint n;
+ guint signal_id;
+ GValue return_value = G_VALUE_INIT;
+ info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
+ g_assert (info != NULL);
+ num_params = g_variant_n_children (parameters);
+ num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
+ n = 0;
+ g_value_init (¶mv[n], TYPE_OBJECT_MAPPER);
+ g_value_set_object (¶mv[n++], skeleton);
+ g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
+ g_value_set_object (¶mv[n++], invocation);
+ if (info->pass_fdlist)
+ {
+#ifdef G_OS_UNIX
+ g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
+ g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
+#else
+ g_assert_not_reached ();
+#endif
+ }
+ g_variant_iter_init (&iter, parameters);
+ while ((child = g_variant_iter_next_value (&iter)) != NULL)
+ {
+ _ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
+ if (arg_info->use_gvariant)
+ {
+ g_value_init (¶mv[n], G_TYPE_VARIANT);
+ g_value_set_variant (¶mv[n], child);
+ n++;
+ }
+ else
+ g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
+ g_variant_unref (child);
+ }
+ signal_id = g_signal_lookup (info->signal_name, TYPE_OBJECT_MAPPER);
+ g_value_init (&return_value, G_TYPE_BOOLEAN);
+ g_signal_emitv (paramv, signal_id, 0, &return_value);
+ if (!g_value_get_boolean (&return_value))
+ g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
+ g_value_unset (&return_value);
+ for (n = 0; n < num_params + num_extra; n++)
+ g_value_unset (¶mv[n]);
+ g_free (paramv);
+}
+
+static GVariant *
+_object_mapper_skeleton_handle_get_property (
+ GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *sender G_GNUC_UNUSED,
+ const gchar *object_path G_GNUC_UNUSED,
+ const gchar *interface_name G_GNUC_UNUSED,
+ const gchar *property_name,
+ GError **error,
+ gpointer user_data)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
+ GValue value = G_VALUE_INIT;
+ GParamSpec *pspec;
+ _ExtendedGDBusPropertyInfo *info;
+ GVariant *ret;
+ ret = NULL;
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name);
+ g_assert (info != NULL);
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
+ if (pspec == NULL)
+ {
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
+ }
+ else
+ {
+ g_value_init (&value, pspec->value_type);
+ g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
+ ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
+ g_value_unset (&value);
+ }
+ return ret;
+}
+
+static gboolean
+_object_mapper_skeleton_handle_set_property (
+ GDBusConnection *connection G_GNUC_UNUSED,
+ const gchar *sender G_GNUC_UNUSED,
+ const gchar *object_path G_GNUC_UNUSED,
+ const gchar *interface_name G_GNUC_UNUSED,
+ const gchar *property_name,
+ GVariant *variant,
+ GError **error,
+ gpointer user_data)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (user_data);
+ GValue value = G_VALUE_INIT;
+ GParamSpec *pspec;
+ _ExtendedGDBusPropertyInfo *info;
+ gboolean ret;
+ ret = FALSE;
+ info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_object_mapper_interface_info.parent_struct, property_name);
+ g_assert (info != NULL);
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
+ if (pspec == NULL)
+ {
+ g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
+ }
+ else
+ {
+ if (info->use_gvariant)
+ g_value_set_variant (&value, variant);
+ else
+ g_dbus_gvariant_to_gvalue (variant, &value);
+ g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
+ g_value_unset (&value);
+ ret = TRUE;
+ }
+ return ret;
+}
+
+static const GDBusInterfaceVTable _object_mapper_skeleton_vtable =
+{
+ _object_mapper_skeleton_handle_method_call,
+ _object_mapper_skeleton_handle_get_property,
+ _object_mapper_skeleton_handle_set_property,
+ {NULL}
+};
+
+static GDBusInterfaceInfo *
+object_mapper_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
+{
+ return object_mapper_interface_info ();
+}
+
+static GDBusInterfaceVTable *
+object_mapper_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
+{
+ return (GDBusInterfaceVTable *) &_object_mapper_skeleton_vtable;
+}
+
+static GVariant *
+object_mapper_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (_skeleton);
+
+ GVariantBuilder builder;
+ guint n;
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+ if (_object_mapper_interface_info.parent_struct.properties == NULL)
+ goto out;
+ for (n = 0; _object_mapper_interface_info.parent_struct.properties[n] != NULL; n++)
+ {
+ GDBusPropertyInfo *info = _object_mapper_interface_info.parent_struct.properties[n];
+ if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
+ {
+ GVariant *value;
+ value = _object_mapper_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Object.Mapper", info->name, NULL, skeleton);
+ if (value != NULL)
+ {
+ g_variant_take_ref (value);
+ g_variant_builder_add (&builder, "{sv}", info->name, value);
+ g_variant_unref (value);
+ }
+ }
+ }
+out:
+ return g_variant_builder_end (&builder);
+}
+
+static void
+object_mapper_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
+{
+}
+
+static void
+_object_mapper_on_signal_object_added (
+ ObjectMapper *object,
+ const gchar *arg_object_path,
+ const gchar *arg_interface_name)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object);
+
+ GList *connections, *l;
+ GVariant *signal_variant;
+ connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
+
+ signal_variant = g_variant_ref_sink (g_variant_new ("(ss)",
+ arg_object_path,
+ arg_interface_name));
+ for (l = connections; l != NULL; l = l->next)
+ {
+ GDBusConnection *connection = l->data;
+ g_dbus_connection_emit_signal (connection,
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Object.Mapper", "ObjectAdded",
+ signal_variant, NULL);
+ }
+ g_variant_unref (signal_variant);
+ g_list_free_full (connections, g_object_unref);
+}
+
+static void object_mapper_skeleton_iface_init (ObjectMapperIface *iface);
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
+ G_ADD_PRIVATE (ObjectMapperSkeleton)
+ G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init));
+
+#else
+G_DEFINE_TYPE_WITH_CODE (ObjectMapperSkeleton, object_mapper_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
+ G_IMPLEMENT_INTERFACE (TYPE_OBJECT_MAPPER, object_mapper_skeleton_iface_init));
+
+#endif
+static void
+object_mapper_skeleton_finalize (GObject *object)
+{
+ ObjectMapperSkeleton *skeleton = OBJECT_MAPPER_SKELETON (object);
+ g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
+ if (skeleton->priv->changed_properties_idle_source != NULL)
+ g_source_destroy (skeleton->priv->changed_properties_idle_source);
+ g_main_context_unref (skeleton->priv->context);
+ g_mutex_clear (&skeleton->priv->lock);
+ G_OBJECT_CLASS (object_mapper_skeleton_parent_class)->finalize (object);
+}
+
+static void
+object_mapper_skeleton_init (ObjectMapperSkeleton *skeleton)
+{
+#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
+ skeleton->priv = object_mapper_skeleton_get_instance_private (skeleton);
+#else
+ skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeletonPrivate);
+#endif
+
+ g_mutex_init (&skeleton->priv->lock);
+ skeleton->priv->context = g_main_context_ref_thread_default ();
+}
+
+static void
+object_mapper_skeleton_class_init (ObjectMapperSkeletonClass *klass)
+{
+ GObjectClass *gobject_class;
+ GDBusInterfaceSkeletonClass *skeleton_class;
+
+ gobject_class = G_OBJECT_CLASS (klass);
+ gobject_class->finalize = object_mapper_skeleton_finalize;
+
+ skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
+ skeleton_class->get_info = object_mapper_skeleton_dbus_interface_get_info;
+ skeleton_class->get_properties = object_mapper_skeleton_dbus_interface_get_properties;
+ skeleton_class->flush = object_mapper_skeleton_dbus_interface_flush;
+ skeleton_class->get_vtable = object_mapper_skeleton_dbus_interface_get_vtable;
+
+#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
+ g_type_class_add_private (klass, sizeof (ObjectMapperSkeletonPrivate));
+#endif
+}
+
+static void
+object_mapper_skeleton_iface_init (ObjectMapperIface *iface)
+{
+ iface->object_added = _object_mapper_on_signal_object_added;
+}
+
+/**
+ * object_mapper_skeleton_new:
+ *
+ * Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>.
+ *
+ * Returns: (transfer full) (type ObjectMapperSkeleton): The skeleton object.
+ */
+ObjectMapper *
+object_mapper_skeleton_new (void)
+{
+ return OBJECT_MAPPER (g_object_new (TYPE_OBJECT_MAPPER_SKELETON, NULL));
+}
+
+/* ------------------------------------------------------------------------
* Code for interface org.openbmc.Fan
* ------------------------------------------------------------------------
*/
@@ -13315,6 +14137,39 @@
NULL
};
+static const _ExtendedGDBusPropertyInfo _control_host_property_info_debug_mode =
+{
+ {
+ -1,
+ (gchar *) "debug_mode",
+ (gchar *) "i",
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
+ NULL
+ },
+ "debug-mode",
+ FALSE
+};
+
+static const _ExtendedGDBusPropertyInfo _control_host_property_info_flash_side =
+{
+ {
+ -1,
+ (gchar *) "flash_side",
+ (gchar *) "s",
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE | G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE,
+ NULL
+ },
+ "flash-side",
+ FALSE
+};
+
+static const _ExtendedGDBusPropertyInfo * const _control_host_property_info_pointers[] =
+{
+ &_control_host_property_info_debug_mode,
+ &_control_host_property_info_flash_side,
+ NULL
+};
+
static const _ExtendedGDBusInterfaceInfo _control_host_interface_info =
{
{
@@ -13322,7 +14177,7 @@
(gchar *) "org.openbmc.control.Host",
(GDBusMethodInfo **) &_control_host_method_info_pointers,
(GDBusSignalInfo **) &_control_host_signal_info_pointers,
- NULL,
+ (GDBusPropertyInfo **) &_control_host_property_info_pointers,
NULL
},
"control-host",
@@ -13355,6 +14210,8 @@
guint
control_host_override_properties (GObjectClass *klass, guint property_id_begin)
{
+ g_object_class_override_property (klass, property_id_begin++, "debug-mode");
+ g_object_class_override_property (klass, property_id_begin++, "flash-side");
return property_id_begin - 1;
}
@@ -13372,6 +14229,8 @@
* @handle_boot: Handler for the #ControlHost::handle-boot signal.
* @handle_reboot: Handler for the #ControlHost::handle-reboot signal.
* @handle_shutdown: Handler for the #ControlHost::handle-shutdown signal.
+ * @get_debug_mode: Getter for the #ControlHost:debug-mode property.
+ * @get_flash_side: Getter for the #ControlHost:flash-side property.
* @booted: Handler for the #ControlHost::booted signal.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-control-Host.top_of_page">org.openbmc.control.Host</link>.
@@ -13469,6 +14328,107 @@
G_TYPE_NONE,
0);
+ /* GObject properties for D-Bus properties: */
+ /**
+ * ControlHost:debug-mode:
+ *
+ * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link>.
+ *
+ * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_int ("debug-mode", "debug_mode", "debug_mode", G_MININT32, G_MAXINT32, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * ControlHost:flash-side:
+ *
+ * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link>.
+ *
+ * Since the D-Bus property for this #GObject property is both readable and writable, it is meaningful to both read from it and write to it on both the service- and client-side.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_string ("flash-side", "flash_side", "flash_side", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+}
+
+/**
+ * control_host_get_debug_mode: (skip)
+ * @object: A #ControlHost.
+ *
+ * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property.
+ *
+ * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * Returns: The property value.
+ */
+gint
+control_host_get_debug_mode (ControlHost *object)
+{
+ return CONTROL_HOST_GET_IFACE (object)->get_debug_mode (object);
+}
+
+/**
+ * control_host_set_debug_mode: (skip)
+ * @object: A #ControlHost.
+ * @value: The value to set.
+ *
+ * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.debug_mode">"debug_mode"</link> D-Bus property to @value.
+ *
+ * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
+ */
+void
+control_host_set_debug_mode (ControlHost *object, gint value)
+{
+ g_object_set (G_OBJECT (object), "debug-mode", value, NULL);
+}
+
+/**
+ * control_host_get_flash_side: (skip)
+ * @object: A #ControlHost.
+ *
+ * Gets the value of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
+ *
+ * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use control_host_dup_flash_side() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
+ */
+const gchar *
+control_host_get_flash_side (ControlHost *object)
+{
+ return CONTROL_HOST_GET_IFACE (object)->get_flash_side (object);
+}
+
+/**
+ * control_host_dup_flash_side: (skip)
+ * @object: A #ControlHost.
+ *
+ * Gets a copy of the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property.
+ *
+ * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
+ */
+gchar *
+control_host_dup_flash_side (ControlHost *object)
+{
+ gchar *value;
+ g_object_get (G_OBJECT (object), "flash-side", &value, NULL);
+ return value;
+}
+
+/**
+ * control_host_set_flash_side: (skip)
+ * @object: A #ControlHost.
+ * @value: The value to set.
+ *
+ * Sets the <link linkend="gdbus-property-org-openbmc-control-Host.flash_side">"flash_side"</link> D-Bus property to @value.
+ *
+ * Since this D-Bus property is both readable and writable, it is meaningful to use this function on both the client- and service-side.
+ */
+void
+control_host_set_flash_side (ControlHost *object, const gchar *value)
+{
+ g_object_set (G_OBJECT (object), "flash-side", value, NULL);
}
/**
@@ -13860,6 +14820,45 @@
GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
+ const _ExtendedGDBusPropertyInfo *info;
+ GVariant *variant;
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
+ info = _control_host_property_info_pointers[prop_id - 1];
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
+ if (info->use_gvariant)
+ {
+ g_value_set_variant (value, variant);
+ }
+ else
+ {
+ if (variant != NULL)
+ g_dbus_gvariant_to_gvalue (variant, value);
+ }
+ if (variant != NULL)
+ g_variant_unref (variant);
+}
+
+static void
+control_host_proxy_set_property_cb (GDBusProxy *proxy,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ const _ExtendedGDBusPropertyInfo *info = user_data;
+ GError *error;
+ GVariant *_ret;
+ error = NULL;
+ _ret = g_dbus_proxy_call_finish (proxy, res, &error);
+ if (!_ret)
+ {
+ g_warning ("Error setting property '%s' on interface org.openbmc.control.Host: %s (%s, %d)",
+ info->parent_struct.name,
+ error->message, g_quark_to_string (error->domain), error->code);
+ g_error_free (error);
+ }
+ else
+ {
+ g_variant_unref (_ret);
+ }
}
static void
@@ -13868,6 +14867,18 @@
const GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
+ const _ExtendedGDBusPropertyInfo *info;
+ GVariant *variant;
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
+ info = _control_host_property_info_pointers[prop_id - 1];
+ variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
+ g_dbus_proxy_call (G_DBUS_PROXY (object),
+ "org.freedesktop.DBus.Properties.Set",
+ g_variant_new ("(ssv)", "org.openbmc.control.Host", info->parent_struct.name, variant),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, (GAsyncReadyCallback) control_host_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
+ g_variant_unref (variant);
}
static void
@@ -13940,6 +14951,36 @@
}
}
+static gint
+control_host_proxy_get_debug_mode (ControlHost *object)
+{
+ ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
+ GVariant *variant;
+ gint value = 0;
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "debug_mode");
+ if (variant != NULL)
+ {
+ value = g_variant_get_int32 (variant);
+ g_variant_unref (variant);
+ }
+ return value;
+}
+
+static const gchar *
+control_host_proxy_get_flash_side (ControlHost *object)
+{
+ ControlHostProxy *proxy = CONTROL_HOST_PROXY (object);
+ GVariant *variant;
+ const gchar *value = NULL;
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "flash_side");
+ if (variant != NULL)
+ {
+ value = g_variant_get_string (variant, NULL);
+ g_variant_unref (variant);
+ }
+ return value;
+}
+
static void
control_host_proxy_init (ControlHostProxy *proxy)
{
@@ -13967,6 +15008,8 @@
proxy_class->g_signal = control_host_proxy_g_signal;
proxy_class->g_properties_changed = control_host_proxy_g_properties_changed;
+ control_host_override_properties (gobject_class, 1);
+
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
g_type_class_add_private (klass, sizeof (ControlHostProxyPrivate));
#endif
@@ -13975,6 +15018,8 @@
static void
control_host_proxy_iface_init (ControlHostIface *iface)
{
+ iface->get_debug_mode = control_host_proxy_get_debug_mode;
+ iface->get_flash_side = control_host_proxy_get_flash_side;
}
/**
@@ -14364,9 +15409,25 @@
return g_variant_builder_end (&builder);
}
+static gboolean _control_host_emit_changed (gpointer user_data);
+
static void
control_host_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (_skeleton);
+ gboolean emit_changed = FALSE;
+
+ g_mutex_lock (&skeleton->priv->lock);
+ if (skeleton->priv->changed_properties_idle_source != NULL)
+ {
+ g_source_destroy (skeleton->priv->changed_properties_idle_source);
+ skeleton->priv->changed_properties_idle_source = NULL;
+ emit_changed = TRUE;
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+
+ if (emit_changed)
+ _control_host_emit_changed (skeleton);
}
static void
@@ -14406,6 +15467,10 @@
control_host_skeleton_finalize (GObject *object)
{
ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ guint n;
+ for (n = 0; n < 2; n++)
+ g_value_unset (&skeleton->priv->properties[n]);
+ g_free (skeleton->priv->properties);
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
if (skeleton->priv->changed_properties_idle_source != NULL)
g_source_destroy (skeleton->priv->changed_properties_idle_source);
@@ -14415,6 +15480,144 @@
}
static void
+control_host_skeleton_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_mutex_lock (&skeleton->priv->lock);
+ g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
+ g_mutex_unlock (&skeleton->priv->lock);
+}
+
+static gboolean
+_control_host_emit_changed (gpointer user_data)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (user_data);
+ GList *l;
+ GVariantBuilder builder;
+ GVariantBuilder invalidated_builder;
+ guint num_changes;
+
+ g_mutex_lock (&skeleton->priv->lock);
+ g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+ g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
+ for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
+ {
+ ChangedProperty *cp = l->data;
+ GVariant *variant;
+ const GValue *cur_value;
+
+ cur_value = &skeleton->priv->properties[cp->prop_id - 1];
+ if (!_g_value_equal (cur_value, &cp->orig_value))
+ {
+ variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
+ g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
+ g_variant_unref (variant);
+ num_changes++;
+ }
+ }
+ if (num_changes > 0)
+ {
+ GList *connections, *ll;
+ GVariant *signal_variant;
+ signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.openbmc.control.Host",
+ &builder, &invalidated_builder));
+ connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
+ for (ll = connections; ll != NULL; ll = ll->next)
+ {
+ GDBusConnection *connection = ll->data;
+
+ g_dbus_connection_emit_signal (connection,
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
+ "org.freedesktop.DBus.Properties",
+ "PropertiesChanged",
+ signal_variant,
+ NULL);
+ }
+ g_variant_unref (signal_variant);
+ g_list_free_full (connections, g_object_unref);
+ }
+ else
+ {
+ g_variant_builder_clear (&builder);
+ g_variant_builder_clear (&invalidated_builder);
+ }
+ g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
+ skeleton->priv->changed_properties = NULL;
+ skeleton->priv->changed_properties_idle_source = NULL;
+ g_mutex_unlock (&skeleton->priv->lock);
+ return FALSE;
+}
+
+static void
+_control_host_schedule_emit_changed (ControlHostSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
+{
+ ChangedProperty *cp;
+ GList *l;
+ cp = NULL;
+ for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
+ {
+ ChangedProperty *i_cp = l->data;
+ if (i_cp->info == info)
+ {
+ cp = i_cp;
+ break;
+ }
+ }
+ if (cp == NULL)
+ {
+ cp = g_new0 (ChangedProperty, 1);
+ cp->prop_id = prop_id;
+ cp->info = info;
+ skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
+ g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
+ g_value_copy (orig_value, &cp->orig_value);
+ }
+}
+
+static void
+control_host_skeleton_notify (GObject *object,
+ GParamSpec *pspec G_GNUC_UNUSED)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ g_mutex_lock (&skeleton->priv->lock);
+ if (skeleton->priv->changed_properties != NULL &&
+ skeleton->priv->changed_properties_idle_source == NULL)
+ {
+ skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
+ g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
+ g_source_set_callback (skeleton->priv->changed_properties_idle_source, _control_host_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
+ g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
+ g_source_unref (skeleton->priv->changed_properties_idle_source);
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+}
+
+static void
+control_host_skeleton_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_mutex_lock (&skeleton->priv->lock);
+ g_object_freeze_notify (object);
+ if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
+ {
+ if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)
+ _control_host_schedule_emit_changed (skeleton, _control_host_property_info_pointers[prop_id - 1], prop_id, &skeleton->priv->properties[prop_id - 1]);
+ g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
+ g_object_notify_by_pspec (object, pspec);
+ }
+ g_mutex_unlock (&skeleton->priv->lock);
+ g_object_thaw_notify (object);
+}
+
+static void
control_host_skeleton_init (ControlHostSkeleton *skeleton)
{
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
@@ -14425,6 +15628,31 @@
g_mutex_init (&skeleton->priv->lock);
skeleton->priv->context = g_main_context_ref_thread_default ();
+ skeleton->priv->properties = g_new0 (GValue, 2);
+ g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
+ g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
+}
+
+static gint
+control_host_skeleton_get_debug_mode (ControlHost *object)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ gint value;
+ g_mutex_lock (&skeleton->priv->lock);
+ value = g_value_get_int (&(skeleton->priv->properties[0]));
+ g_mutex_unlock (&skeleton->priv->lock);
+ return value;
+}
+
+static const gchar *
+control_host_skeleton_get_flash_side (ControlHost *object)
+{
+ ControlHostSkeleton *skeleton = CONTROL_HOST_SKELETON (object);
+ const gchar *value;
+ g_mutex_lock (&skeleton->priv->lock);
+ value = g_value_get_string (&(skeleton->priv->properties[1]));
+ g_mutex_unlock (&skeleton->priv->lock);
+ return value;
}
static void
@@ -14435,6 +15663,12 @@
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = control_host_skeleton_finalize;
+ gobject_class->get_property = control_host_skeleton_get_property;
+ gobject_class->set_property = control_host_skeleton_set_property;
+ gobject_class->notify = control_host_skeleton_notify;
+
+
+ control_host_override_properties (gobject_class, 1);
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
skeleton_class->get_info = control_host_skeleton_dbus_interface_get_info;
@@ -14451,6 +15685,8 @@
control_host_skeleton_iface_init (ControlHostIface *iface)
{
iface->booted = _control_host_on_signal_booted;
+ iface->get_debug_mode = control_host_skeleton_get_debug_mode;
+ iface->get_flash_side = control_host_skeleton_get_flash_side;
}
/**
@@ -23103,78 +24339,78 @@
FALSE
};
-static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_press =
+static const _ExtendedGDBusMethodInfo _button_method_info_sim_press =
{
{
-1,
- (gchar *) "simButtonPress",
+ (gchar *) "simPress",
NULL,
NULL,
NULL
},
- "handle-sim-button-press",
+ "handle-sim-press",
FALSE
};
-static const _ExtendedGDBusMethodInfo _button_method_info_sim_button_long_press =
+static const _ExtendedGDBusMethodInfo _button_method_info_sim_long_press =
{
{
-1,
- (gchar *) "simButtonLongPress",
+ (gchar *) "simLongPress",
NULL,
NULL,
NULL
},
- "handle-sim-button-long-press",
+ "handle-sim-long-press",
FALSE
};
static const _ExtendedGDBusMethodInfo * const _button_method_info_pointers[] =
{
&_button_method_info_is_on,
- &_button_method_info_sim_button_press,
- &_button_method_info_sim_button_long_press,
+ &_button_method_info_sim_press,
+ &_button_method_info_sim_long_press,
NULL
};
-static const _ExtendedGDBusSignalInfo _button_signal_info_button_release =
+static const _ExtendedGDBusSignalInfo _button_signal_info_released =
{
{
-1,
- (gchar *) "ButtonRelease",
+ (gchar *) "Released",
NULL,
NULL
},
- "button-release"
+ "released"
};
-static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed =
+static const _ExtendedGDBusSignalInfo _button_signal_info_pressed =
{
{
-1,
- (gchar *) "ButtonPressed",
+ (gchar *) "Pressed",
NULL,
NULL
},
- "button-pressed"
+ "pressed"
};
-static const _ExtendedGDBusSignalInfo _button_signal_info_button_pressed_long =
+static const _ExtendedGDBusSignalInfo _button_signal_info_pressed_long =
{
{
-1,
- (gchar *) "ButtonPressedLong",
+ (gchar *) "PressedLong",
NULL,
NULL
},
- "button-pressed-long"
+ "pressed-long"
};
static const _ExtendedGDBusSignalInfo * const _button_signal_info_pointers[] =
{
- &_button_signal_info_button_release,
- &_button_signal_info_button_pressed,
- &_button_signal_info_button_pressed_long,
+ &_button_signal_info_released,
+ &_button_signal_info_pressed,
+ &_button_signal_info_pressed_long,
NULL
};
@@ -23191,9 +24427,23 @@
FALSE
};
+static const _ExtendedGDBusPropertyInfo _button_property_info_timer =
+{
+ {
+ -1,
+ (gchar *) "timer",
+ (gchar *) "t",
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
+ NULL
+ },
+ "timer",
+ FALSE
+};
+
static const _ExtendedGDBusPropertyInfo * const _button_property_info_pointers[] =
{
&_button_property_info_state,
+ &_button_property_info_timer,
NULL
};
@@ -23238,6 +24488,7 @@
button_override_properties (GObjectClass *klass, guint property_id_begin)
{
g_object_class_override_property (klass, property_id_begin++, "state");
+ g_object_class_override_property (klass, property_id_begin++, "timer");
return property_id_begin - 1;
}
@@ -23253,12 +24504,13 @@
* ButtonIface:
* @parent_iface: The parent interface.
* @handle_is_on: Handler for the #Button::handle-is-on signal.
- * @handle_sim_button_long_press: Handler for the #Button::handle-sim-button-long-press signal.
- * @handle_sim_button_press: Handler for the #Button::handle-sim-button-press signal.
+ * @handle_sim_long_press: Handler for the #Button::handle-sim-long-press signal.
+ * @handle_sim_press: Handler for the #Button::handle-sim-press signal.
* @get_state: Getter for the #Button:state property.
- * @button_pressed: Handler for the #Button::button-pressed signal.
- * @button_pressed_long: Handler for the #Button::button-pressed-long signal.
- * @button_release: Handler for the #Button::button-release signal.
+ * @get_timer: Getter for the #Button:timer property.
+ * @pressed: Handler for the #Button::pressed signal.
+ * @pressed_long: Handler for the #Button::pressed-long signal.
+ * @released: Handler for the #Button::released signal.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Button.top_of_page">org.openbmc.Button</link>.
*/
@@ -23293,20 +24545,20 @@
G_TYPE_DBUS_METHOD_INVOCATION);
/**
- * Button::handle-sim-button-press:
+ * Button::handle-sim-press:
* @object: A #Button.
* @invocation: A #GDBusMethodInvocation.
*
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method.
+ * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method.
*
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_button_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+ * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
*
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
*/
- g_signal_new ("handle-sim-button-press",
+ g_signal_new ("handle-sim-press",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ButtonIface, handle_sim_button_press),
+ G_STRUCT_OFFSET (ButtonIface, handle_sim_press),
g_signal_accumulator_true_handled,
NULL,
g_cclosure_marshal_generic,
@@ -23315,20 +24567,20 @@
G_TYPE_DBUS_METHOD_INVOCATION);
/**
- * Button::handle-sim-button-long-press:
+ * Button::handle-sim-long-press:
* @object: A #Button.
* @invocation: A #GDBusMethodInvocation.
*
- * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method.
+ * Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method.
*
- * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_button_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
+ * If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call button_complete_sim_long_press() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
*
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
*/
- g_signal_new ("handle-sim-button-long-press",
+ g_signal_new ("handle-sim-long-press",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ButtonIface, handle_sim_button_long_press),
+ G_STRUCT_OFFSET (ButtonIface, handle_sim_long_press),
g_signal_accumulator_true_handled,
NULL,
g_cclosure_marshal_generic,
@@ -23338,17 +24590,17 @@
/* GObject signals for received D-Bus signals: */
/**
- * Button::button-release:
+ * Button::released:
* @object: A #Button.
*
- * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> is received.
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> is received.
*
* On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
*/
- g_signal_new ("button-release",
+ g_signal_new ("released",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ButtonIface, button_release),
+ G_STRUCT_OFFSET (ButtonIface, released),
NULL,
NULL,
g_cclosure_marshal_generic,
@@ -23356,17 +24608,17 @@
0);
/**
- * Button::button-pressed:
+ * Button::pressed:
* @object: A #Button.
*
- * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> is received.
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> is received.
*
* On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
*/
- g_signal_new ("button-pressed",
+ g_signal_new ("pressed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ButtonIface, button_pressed),
+ G_STRUCT_OFFSET (ButtonIface, pressed),
NULL,
NULL,
g_cclosure_marshal_generic,
@@ -23374,17 +24626,17 @@
0);
/**
- * Button::button-pressed-long:
+ * Button::pressed-long:
* @object: A #Button.
*
- * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> is received.
+ * On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> is received.
*
* On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
*/
- g_signal_new ("button-pressed-long",
+ g_signal_new ("pressed-long",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ButtonIface, button_pressed_long),
+ G_STRUCT_OFFSET (ButtonIface, pressed_long),
NULL,
NULL,
g_cclosure_marshal_generic,
@@ -23401,6 +24653,15 @@
*/
g_object_interface_install_property (iface,
g_param_spec_boolean ("state", "state", "state", FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * Button:timer:
+ *
+ * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link>.
+ *
+ * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_uint64 ("timer", "timer", "timer", 0, G_MAXUINT64, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
@@ -23435,42 +24696,73 @@
}
/**
- * button_emit_button_release:
+ * button_get_timer: (skip)
* @object: A #Button.
*
- * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonRelease">"ButtonRelease"</link> D-Bus signal.
+ * Gets the value of the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property.
+ *
+ * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * Returns: The property value.
*/
-void
-button_emit_button_release (
- Button *object)
+guint64
+button_get_timer (Button *object)
{
- g_signal_emit_by_name (object, "button-release");
+ return BUTTON_GET_IFACE (object)->get_timer (object);
}
/**
- * button_emit_button_pressed:
+ * button_set_timer: (skip)
* @object: A #Button.
+ * @value: The value to set.
*
- * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressed">"ButtonPressed"</link> D-Bus signal.
+ * Sets the <link linkend="gdbus-property-org-openbmc-Button.timer">"timer"</link> D-Bus property to @value.
+ *
+ * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
*/
void
-button_emit_button_pressed (
- Button *object)
+button_set_timer (Button *object, guint64 value)
{
- g_signal_emit_by_name (object, "button-pressed");
+ g_object_set (G_OBJECT (object), "timer", value, NULL);
}
/**
- * button_emit_button_pressed_long:
+ * button_emit_released:
* @object: A #Button.
*
- * Emits the <link linkend="gdbus-signal-org-openbmc-Button.ButtonPressedLong">"ButtonPressedLong"</link> D-Bus signal.
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Released">"Released"</link> D-Bus signal.
*/
void
-button_emit_button_pressed_long (
+button_emit_released (
Button *object)
{
- g_signal_emit_by_name (object, "button-pressed-long");
+ g_signal_emit_by_name (object, "released");
+}
+
+/**
+ * button_emit_pressed:
+ * @object: A #Button.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Button.Pressed">"Pressed"</link> D-Bus signal.
+ */
+void
+button_emit_pressed (
+ Button *object)
+{
+ g_signal_emit_by_name (object, "pressed");
+}
+
+/**
+ * button_emit_pressed_long:
+ * @object: A #Button.
+ *
+ * Emits the <link linkend="gdbus-signal-org-openbmc-Button.PressedLong">"PressedLong"</link> D-Bus signal.
+ */
+void
+button_emit_pressed_long (
+ Button *object)
+{
+ g_signal_emit_by_name (object, "pressed-long");
}
/**
@@ -23572,27 +24864,27 @@
}
/**
- * button_call_sim_button_press:
+ * button_call_sim_press:
* @proxy: A #ButtonProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
* @user_data: User data to pass to @callback.
*
- * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy.
+ * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy.
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call button_call_sim_button_press_finish() to get the result of the operation.
+ * You can then call button_call_sim_press_finish() to get the result of the operation.
*
- * See button_call_sim_button_press_sync() for the synchronous, blocking version of this method.
+ * See button_call_sim_press_sync() for the synchronous, blocking version of this method.
*/
void
-button_call_sim_button_press (
+button_call_sim_press (
Button *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "simButtonPress",
+ "simPress",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -23602,17 +24894,17 @@
}
/**
- * button_call_sim_button_press_finish:
+ * button_call_sim_press_finish:
* @proxy: A #ButtonProxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_press().
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_press().
* @error: Return location for error or %NULL.
*
- * Finishes an operation started with button_call_sim_button_press().
+ * Finishes an operation started with button_call_sim_press().
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*/
gboolean
-button_call_sim_button_press_finish (
+button_call_sim_press_finish (
Button *proxy,
GAsyncResult *res,
GError **error)
@@ -23629,26 +24921,26 @@
}
/**
- * button_call_sim_button_press_sync:
+ * button_call_sim_press_sync:
* @proxy: A #ButtonProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
*
- * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
*
- * See button_call_sim_button_press() for the asynchronous version of this method.
+ * See button_call_sim_press() for the asynchronous version of this method.
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*/
gboolean
-button_call_sim_button_press_sync (
+button_call_sim_press_sync (
Button *proxy,
GCancellable *cancellable,
GError **error)
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "simButtonPress",
+ "simPress",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -23664,27 +24956,27 @@
}
/**
- * button_call_sim_button_long_press:
+ * button_call_sim_long_press:
* @proxy: A #ButtonProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
* @user_data: User data to pass to @callback.
*
- * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy.
+ * Asynchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy.
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
- * You can then call button_call_sim_button_long_press_finish() to get the result of the operation.
+ * You can then call button_call_sim_long_press_finish() to get the result of the operation.
*
- * See button_call_sim_button_long_press_sync() for the synchronous, blocking version of this method.
+ * See button_call_sim_long_press_sync() for the synchronous, blocking version of this method.
*/
void
-button_call_sim_button_long_press (
+button_call_sim_long_press (
Button *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
- "simButtonLongPress",
+ "simLongPress",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -23694,17 +24986,17 @@
}
/**
- * button_call_sim_button_long_press_finish:
+ * button_call_sim_long_press_finish:
* @proxy: A #ButtonProxy.
- * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_button_long_press().
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to button_call_sim_long_press().
* @error: Return location for error or %NULL.
*
- * Finishes an operation started with button_call_sim_button_long_press().
+ * Finishes an operation started with button_call_sim_long_press().
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*/
gboolean
-button_call_sim_button_long_press_finish (
+button_call_sim_long_press_finish (
Button *proxy,
GAsyncResult *res,
GError **error)
@@ -23721,26 +25013,26 @@
}
/**
- * button_call_sim_button_long_press_sync:
+ * button_call_sim_long_press_sync:
* @proxy: A #ButtonProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
*
- * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
+ * Synchronously invokes the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
*
- * See button_call_sim_button_long_press() for the asynchronous version of this method.
+ * See button_call_sim_long_press() for the asynchronous version of this method.
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*/
gboolean
-button_call_sim_button_long_press_sync (
+button_call_sim_long_press_sync (
Button *proxy,
GCancellable *cancellable,
GError **error)
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
- "simButtonLongPress",
+ "simLongPress",
g_variant_new ("()"),
G_DBUS_CALL_FLAGS_NONE,
-1,
@@ -23777,16 +25069,16 @@
}
/**
- * button_complete_sim_button_press:
+ * button_complete_sim_press:
* @object: A #Button.
* @invocation: (transfer full): A #GDBusMethodInvocation.
*
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonPress">simButtonPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simPress">simPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
*
* This method will free @invocation, you cannot use it afterwards.
*/
void
-button_complete_sim_button_press (
+button_complete_sim_press (
Button *object,
GDBusMethodInvocation *invocation)
{
@@ -23795,16 +25087,16 @@
}
/**
- * button_complete_sim_button_long_press:
+ * button_complete_sim_long_press:
* @object: A #Button.
* @invocation: (transfer full): A #GDBusMethodInvocation.
*
- * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simButtonLongPress">simButtonLongPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
+ * Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-openbmc-Button.simLongPress">simLongPress()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
*
* This method will free @invocation, you cannot use it afterwards.
*/
void
-button_complete_sim_button_long_press (
+button_complete_sim_long_press (
Button *object,
GDBusMethodInvocation *invocation)
{
@@ -23860,7 +25152,7 @@
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
- g_assert (prop_id != 0 && prop_id - 1 < 1);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
info = _button_property_info_pointers[prop_id - 1];
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
if (info->use_gvariant)
@@ -23907,7 +25199,7 @@
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
- g_assert (prop_id != 0 && prop_id - 1 < 1);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
info = _button_property_info_pointers[prop_id - 1];
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
g_dbus_proxy_call (G_DBUS_PROXY (object),
@@ -24004,6 +25296,21 @@
return value;
}
+static guint64
+button_proxy_get_timer (Button *object)
+{
+ ButtonProxy *proxy = BUTTON_PROXY (object);
+ GVariant *variant;
+ guint64 value = 0;
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "timer");
+ if (variant != NULL)
+ {
+ value = g_variant_get_uint64 (variant);
+ g_variant_unref (variant);
+ }
+ return value;
+}
+
static void
button_proxy_init (ButtonProxy *proxy)
{
@@ -24042,6 +25349,7 @@
button_proxy_iface_init (ButtonIface *iface)
{
iface->get_state = button_proxy_get_state;
+ iface->get_timer = button_proxy_get_timer;
}
/**
@@ -24453,7 +25761,7 @@
}
static void
-_button_on_signal_button_release (
+_button_on_signal_released (
Button *object)
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
@@ -24467,7 +25775,7 @@
{
GDBusConnection *connection = l->data;
g_dbus_connection_emit_signal (connection,
- NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonRelease",
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Released",
signal_variant, NULL);
}
g_variant_unref (signal_variant);
@@ -24475,7 +25783,7 @@
}
static void
-_button_on_signal_button_pressed (
+_button_on_signal_pressed (
Button *object)
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
@@ -24489,7 +25797,7 @@
{
GDBusConnection *connection = l->data;
g_dbus_connection_emit_signal (connection,
- NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressed",
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "Pressed",
signal_variant, NULL);
}
g_variant_unref (signal_variant);
@@ -24497,7 +25805,7 @@
}
static void
-_button_on_signal_button_pressed_long (
+_button_on_signal_pressed_long (
Button *object)
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
@@ -24511,7 +25819,7 @@
{
GDBusConnection *connection = l->data;
g_dbus_connection_emit_signal (connection,
- NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "ButtonPressedLong",
+ NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.openbmc.Button", "PressedLong",
signal_variant, NULL);
}
g_variant_unref (signal_variant);
@@ -24534,7 +25842,7 @@
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
guint n;
- for (n = 0; n < 1; n++)
+ for (n = 0; n < 2; n++)
g_value_unset (&skeleton->priv->properties[n]);
g_free (skeleton->priv->properties);
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
@@ -24552,7 +25860,7 @@
GParamSpec *pspec G_GNUC_UNUSED)
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 1);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
g_mutex_lock (&skeleton->priv->lock);
g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
g_mutex_unlock (&skeleton->priv->lock);
@@ -24669,7 +25977,7 @@
GParamSpec *pspec)
{
ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 1);
+ g_assert (prop_id != 0 && prop_id - 1 < 2);
g_mutex_lock (&skeleton->priv->lock);
g_object_freeze_notify (object);
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
@@ -24694,8 +26002,9 @@
g_mutex_init (&skeleton->priv->lock);
skeleton->priv->context = g_main_context_ref_thread_default ();
- skeleton->priv->properties = g_new0 (GValue, 1);
+ skeleton->priv->properties = g_new0 (GValue, 2);
g_value_init (&skeleton->priv->properties[0], G_TYPE_BOOLEAN);
+ g_value_init (&skeleton->priv->properties[1], G_TYPE_UINT64);
}
static gboolean
@@ -24709,6 +26018,17 @@
return value;
}
+static guint64
+button_skeleton_get_timer (Button *object)
+{
+ ButtonSkeleton *skeleton = BUTTON_SKELETON (object);
+ guint64 value;
+ g_mutex_lock (&skeleton->priv->lock);
+ value = g_value_get_uint64 (&(skeleton->priv->properties[1]));
+ g_mutex_unlock (&skeleton->priv->lock);
+ return value;
+}
+
static void
button_skeleton_class_init (ButtonSkeletonClass *klass)
{
@@ -24738,10 +26058,11 @@
static void
button_skeleton_iface_init (ButtonIface *iface)
{
- iface->button_release = _button_on_signal_button_release;
- iface->button_pressed = _button_on_signal_button_pressed;
- iface->button_pressed_long = _button_on_signal_button_pressed_long;
+ iface->released = _button_on_signal_released;
+ iface->pressed = _button_on_signal_pressed;
+ iface->pressed_long = _button_on_signal_pressed_long;
iface->get_state = button_skeleton_get_state;
+ iface->get_timer = button_skeleton_get_timer;
}
/**
@@ -24859,10 +26180,24 @@
FALSE
};
+static const _ExtendedGDBusPropertyInfo _led_property_info_state =
+{
+ {
+ -1,
+ (gchar *) "state",
+ (gchar *) "s",
+ G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
+ NULL
+ },
+ "state",
+ FALSE
+};
+
static const _ExtendedGDBusPropertyInfo * const _led_property_info_pointers[] =
{
&_led_property_info_color,
&_led_property_info_function,
+ &_led_property_info_state,
NULL
};
@@ -24908,6 +26243,7 @@
{
g_object_class_override_property (klass, property_id_begin++, "color");
g_object_class_override_property (klass, property_id_begin++, "function");
+ g_object_class_override_property (klass, property_id_begin++, "state");
return property_id_begin - 1;
}
@@ -24928,6 +26264,7 @@
* @handle_set_on: Handler for the #Led::handle-set-on signal.
* @get_color: Getter for the #Led:color property.
* @get_function: Getter for the #Led:function property.
+ * @get_state: Getter for the #Led:state property.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Led.top_of_page">org.openbmc.Led</link>.
*/
@@ -25046,6 +26383,15 @@
*/
g_object_interface_install_property (iface,
g_param_spec_string ("function", "function", "function", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * Led:state:
+ *
+ * Represents the D-Bus property <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link>.
+ *
+ * Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
+ */
+ g_object_interface_install_property (iface,
+ g_param_spec_string ("state", "state", "state", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
@@ -25131,6 +26477,57 @@
}
/**
+ * led_get_state: (skip)
+ * @object: A #Led.
+ *
+ * Gets the value of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
+ *
+ * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use led_dup_state() if on another thread.</warning>
+ *
+ * Returns: (transfer none): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
+ */
+const gchar *
+led_get_state (Led *object)
+{
+ return LED_GET_IFACE (object)->get_state (object);
+}
+
+/**
+ * led_dup_state: (skip)
+ * @object: A #Led.
+ *
+ * Gets a copy of the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property.
+ *
+ * Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
+ *
+ * Returns: (transfer full): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
+ */
+gchar *
+led_dup_state (Led *object)
+{
+ gchar *value;
+ g_object_get (G_OBJECT (object), "state", &value, NULL);
+ return value;
+}
+
+/**
+ * led_set_state: (skip)
+ * @object: A #Led.
+ * @value: The value to set.
+ *
+ * Sets the <link linkend="gdbus-property-org-openbmc-Led.state">"state"</link> D-Bus property to @value.
+ *
+ * Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
+ */
+void
+led_set_state (Led *object, const gchar *value)
+{
+ g_object_set (G_OBJECT (object), "state", value, NULL);
+}
+
+/**
* led_call_set_on:
* @proxy: A #LedProxy.
* @cancellable: (allow-none): A #GCancellable or %NULL.
@@ -25618,7 +27015,7 @@
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
- g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_assert (prop_id != 0 && prop_id - 1 < 3);
info = _led_property_info_pointers[prop_id - 1];
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
if (info->use_gvariant)
@@ -25665,7 +27062,7 @@
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
- g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_assert (prop_id != 0 && prop_id - 1 < 3);
info = _led_property_info_pointers[prop_id - 1];
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
g_dbus_proxy_call (G_DBUS_PROXY (object),
@@ -25777,6 +27174,21 @@
return value;
}
+static const gchar *
+led_proxy_get_state (Led *object)
+{
+ LedProxy *proxy = LED_PROXY (object);
+ GVariant *variant;
+ const gchar *value = NULL;
+ variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "state");
+ if (variant != NULL)
+ {
+ value = g_variant_get_string (variant, NULL);
+ g_variant_unref (variant);
+ }
+ return value;
+}
+
static void
led_proxy_init (LedProxy *proxy)
{
@@ -25816,6 +27228,7 @@
{
iface->get_color = led_proxy_get_color;
iface->get_function = led_proxy_get_function;
+ iface->get_state = led_proxy_get_state;
}
/**
@@ -26242,7 +27655,7 @@
{
LedSkeleton *skeleton = LED_SKELETON (object);
guint n;
- for (n = 0; n < 2; n++)
+ for (n = 0; n < 3; n++)
g_value_unset (&skeleton->priv->properties[n]);
g_free (skeleton->priv->properties);
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
@@ -26260,7 +27673,7 @@
GParamSpec *pspec G_GNUC_UNUSED)
{
LedSkeleton *skeleton = LED_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_assert (prop_id != 0 && prop_id - 1 < 3);
g_mutex_lock (&skeleton->priv->lock);
g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
g_mutex_unlock (&skeleton->priv->lock);
@@ -26377,7 +27790,7 @@
GParamSpec *pspec)
{
LedSkeleton *skeleton = LED_SKELETON (object);
- g_assert (prop_id != 0 && prop_id - 1 < 2);
+ g_assert (prop_id != 0 && prop_id - 1 < 3);
g_mutex_lock (&skeleton->priv->lock);
g_object_freeze_notify (object);
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
@@ -26402,9 +27815,10 @@
g_mutex_init (&skeleton->priv->lock);
skeleton->priv->context = g_main_context_ref_thread_default ();
- skeleton->priv->properties = g_new0 (GValue, 2);
+ skeleton->priv->properties = g_new0 (GValue, 3);
g_value_init (&skeleton->priv->properties[0], G_TYPE_INT);
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
+ g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
}
static gint
@@ -26429,6 +27843,17 @@
return value;
}
+static const gchar *
+led_skeleton_get_state (Led *object)
+{
+ LedSkeleton *skeleton = LED_SKELETON (object);
+ const gchar *value;
+ g_mutex_lock (&skeleton->priv->lock);
+ value = g_value_get_string (&(skeleton->priv->properties[2]));
+ g_mutex_unlock (&skeleton->priv->lock);
+ return value;
+}
+
static void
led_skeleton_class_init (LedSkeletonClass *klass)
{
@@ -26460,6 +27885,7 @@
{
iface->get_color = led_skeleton_get_color;
iface->get_function = led_skeleton_get_function;
+ iface->get_state = led_skeleton_get_state;
}
/**
@@ -27624,6 +29050,15 @@
object_default_init (ObjectIface *iface)
{
/**
+ * Object:object-mapper:
+ *
+ * The #ObjectMapper instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link>, if any.
+ *
+ * Connect to the #GObject::notify signal to get informed of property changes.
+ */
+ g_object_interface_install_property (iface, g_param_spec_object ("object-mapper", "object-mapper", "object-mapper", TYPE_OBJECT_MAPPER, G_PARAM_READWRITE|G_PARAM_STATIC_STRINGS));
+
+ /**
* Object:fan:
*
* The #Fan instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Fan.top_of_page">org.openbmc.Fan</link>, if any.
@@ -27788,6 +29223,23 @@
}
/**
+ * object_get_object_mapper:
+ * @object: A #Object.
+ *
+ * Gets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object, if any.
+ *
+ * Returns: (transfer full): A #ObjectMapper that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
+ */
+ObjectMapper *object_get_object_mapper (Object *object)
+{
+ GDBusInterface *ret;
+ ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
+ if (ret == NULL)
+ return NULL;
+ return OBJECT_MAPPER (ret);
+}
+
+/**
* object_get_fan:
* @object: A #Object.
*
@@ -28095,6 +29547,26 @@
/**
+ * object_peek_object_mapper: (skip)
+ * @object: A #Object.
+ *
+ * Like object_get_object_mapper() but doesn't increase the reference count on the returned object.
+ *
+ * <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
+ *
+ * Returns: (transfer none): A #ObjectMapper or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
+ */
+ObjectMapper *object_peek_object_mapper (Object *object)
+{
+ GDBusInterface *ret;
+ ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
+ if (ret == NULL)
+ return NULL;
+ g_object_unref (ret);
+ return OBJECT_MAPPER (ret);
+}
+
+/**
* object_peek_fan: (skip)
* @object: A #Object.
*
@@ -28522,91 +29994,96 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
g_value_take_object (value, interface);
break;
case 2:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
case 3:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
case 4:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
case 5:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
case 6:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
case 7:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
case 8:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
case 9:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
case 10:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
case 11:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
case 12:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
case 13:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
case 14:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
case 15:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
case 16:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
case 17:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
case 18:
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
+ g_value_take_object (value, interface);
+ break;
+
+ case 19:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -28625,24 +30102,25 @@
gobject_class->set_property = object_proxy_set_property;
gobject_class->get_property = object_proxy_get_property;
- g_object_class_override_property (gobject_class, 1, "fan");
- g_object_class_override_property (gobject_class, 2, "sensor-value");
- g_object_class_override_property (gobject_class, 3, "sensor-threshold");
- g_object_class_override_property (gobject_class, 4, "sensor-i2c");
- g_object_class_override_property (gobject_class, 5, "sensor-match");
- g_object_class_override_property (gobject_class, 6, "process");
- g_object_class_override_property (gobject_class, 7, "shared-resource");
- g_object_class_override_property (gobject_class, 8, "control");
- g_object_class_override_property (gobject_class, 9, "control-bmc");
- g_object_class_override_property (gobject_class, 10, "control-host");
- g_object_class_override_property (gobject_class, 11, "control-power");
- g_object_class_override_property (gobject_class, 12, "watchdog");
- g_object_class_override_property (gobject_class, 13, "event-log");
- g_object_class_override_property (gobject_class, 14, "flash");
- g_object_class_override_property (gobject_class, 15, "flash-control");
- g_object_class_override_property (gobject_class, 16, "button");
- g_object_class_override_property (gobject_class, 17, "led");
- g_object_class_override_property (gobject_class, 18, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "object-mapper");
+ g_object_class_override_property (gobject_class, 2, "fan");
+ g_object_class_override_property (gobject_class, 3, "sensor-value");
+ g_object_class_override_property (gobject_class, 4, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 5, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 6, "sensor-match");
+ g_object_class_override_property (gobject_class, 7, "process");
+ g_object_class_override_property (gobject_class, 8, "shared-resource");
+ g_object_class_override_property (gobject_class, 9, "control");
+ g_object_class_override_property (gobject_class, 10, "control-bmc");
+ g_object_class_override_property (gobject_class, 11, "control-host");
+ g_object_class_override_property (gobject_class, 12, "control-power");
+ g_object_class_override_property (gobject_class, 13, "watchdog");
+ g_object_class_override_property (gobject_class, 14, "event-log");
+ g_object_class_override_property (gobject_class, 15, "flash");
+ g_object_class_override_property (gobject_class, 16, "flash-control");
+ g_object_class_override_property (gobject_class, 17, "button");
+ g_object_class_override_property (gobject_class, 18, "led");
+ g_object_class_override_property (gobject_class, 19, "host-ipmi");
}
/**
@@ -28713,6 +30191,19 @@
interface = g_value_get_object (value);
if (interface != NULL)
{
+ g_warn_if_fail (IS_OBJECT_MAPPER (interface));
+ g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
+ }
+ else
+ {
+ g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.openbmc.Object.Mapper");
+ }
+ break;
+
+ case 2:
+ interface = g_value_get_object (value);
+ if (interface != NULL)
+ {
g_warn_if_fail (IS_FAN (interface));
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
}
@@ -28722,7 +30213,7 @@
}
break;
- case 2:
+ case 3:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28735,7 +30226,7 @@
}
break;
- case 3:
+ case 4:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28748,7 +30239,7 @@
}
break;
- case 4:
+ case 5:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28761,7 +30252,7 @@
}
break;
- case 5:
+ case 6:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28774,7 +30265,7 @@
}
break;
- case 6:
+ case 7:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28787,7 +30278,7 @@
}
break;
- case 7:
+ case 8:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28800,7 +30291,7 @@
}
break;
- case 8:
+ case 9:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28813,7 +30304,7 @@
}
break;
- case 9:
+ case 10:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28826,7 +30317,7 @@
}
break;
- case 10:
+ case 11:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28839,7 +30330,7 @@
}
break;
- case 11:
+ case 12:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28852,7 +30343,7 @@
}
break;
- case 12:
+ case 13:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28865,7 +30356,7 @@
}
break;
- case 13:
+ case 14:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28878,7 +30369,7 @@
}
break;
- case 14:
+ case 15:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28891,7 +30382,7 @@
}
break;
- case 15:
+ case 16:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28904,7 +30395,7 @@
}
break;
- case 16:
+ case 17:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28917,7 +30408,7 @@
}
break;
- case 17:
+ case 18:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28930,7 +30421,7 @@
}
break;
- case 18:
+ case 19:
interface = g_value_get_object (value);
if (interface != NULL)
{
@@ -28961,91 +30452,96 @@
switch (prop_id)
{
case 1:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Object.Mapper");
g_value_take_object (value, interface);
break;
case 2:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Fan");
g_value_take_object (value, interface);
break;
case 3:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorValue");
g_value_take_object (value, interface);
break;
case 4:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorThreshold");
g_value_take_object (value, interface);
break;
case 5:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorI2c");
g_value_take_object (value, interface);
break;
case 6:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SensorMatch");
g_value_take_object (value, interface);
break;
case 7:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Process");
g_value_take_object (value, interface);
break;
case 8:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.SharedResource");
g_value_take_object (value, interface);
break;
case 9:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Control");
g_value_take_object (value, interface);
break;
case 10:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Bmc");
g_value_take_object (value, interface);
break;
case 11:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Host");
g_value_take_object (value, interface);
break;
case 12:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.control.Power");
g_value_take_object (value, interface);
break;
case 13:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Watchdog");
g_value_take_object (value, interface);
break;
case 14:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.EventLog");
g_value_take_object (value, interface);
break;
case 15:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Flash");
g_value_take_object (value, interface);
break;
case 16:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.FlashControl");
g_value_take_object (value, interface);
break;
case 17:
- interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Button");
g_value_take_object (value, interface);
break;
case 18:
+ interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.Led");
+ g_value_take_object (value, interface);
+ break;
+
+ case 19:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.openbmc.HostIpmi");
g_value_take_object (value, interface);
break;
@@ -29064,24 +30560,25 @@
gobject_class->set_property = object_skeleton_set_property;
gobject_class->get_property = object_skeleton_get_property;
- g_object_class_override_property (gobject_class, 1, "fan");
- g_object_class_override_property (gobject_class, 2, "sensor-value");
- g_object_class_override_property (gobject_class, 3, "sensor-threshold");
- g_object_class_override_property (gobject_class, 4, "sensor-i2c");
- g_object_class_override_property (gobject_class, 5, "sensor-match");
- g_object_class_override_property (gobject_class, 6, "process");
- g_object_class_override_property (gobject_class, 7, "shared-resource");
- g_object_class_override_property (gobject_class, 8, "control");
- g_object_class_override_property (gobject_class, 9, "control-bmc");
- g_object_class_override_property (gobject_class, 10, "control-host");
- g_object_class_override_property (gobject_class, 11, "control-power");
- g_object_class_override_property (gobject_class, 12, "watchdog");
- g_object_class_override_property (gobject_class, 13, "event-log");
- g_object_class_override_property (gobject_class, 14, "flash");
- g_object_class_override_property (gobject_class, 15, "flash-control");
- g_object_class_override_property (gobject_class, 16, "button");
- g_object_class_override_property (gobject_class, 17, "led");
- g_object_class_override_property (gobject_class, 18, "host-ipmi");
+ g_object_class_override_property (gobject_class, 1, "object-mapper");
+ g_object_class_override_property (gobject_class, 2, "fan");
+ g_object_class_override_property (gobject_class, 3, "sensor-value");
+ g_object_class_override_property (gobject_class, 4, "sensor-threshold");
+ g_object_class_override_property (gobject_class, 5, "sensor-i2c");
+ g_object_class_override_property (gobject_class, 6, "sensor-match");
+ g_object_class_override_property (gobject_class, 7, "process");
+ g_object_class_override_property (gobject_class, 8, "shared-resource");
+ g_object_class_override_property (gobject_class, 9, "control");
+ g_object_class_override_property (gobject_class, 10, "control-bmc");
+ g_object_class_override_property (gobject_class, 11, "control-host");
+ g_object_class_override_property (gobject_class, 12, "control-power");
+ g_object_class_override_property (gobject_class, 13, "watchdog");
+ g_object_class_override_property (gobject_class, 14, "event-log");
+ g_object_class_override_property (gobject_class, 15, "flash");
+ g_object_class_override_property (gobject_class, 16, "flash-control");
+ g_object_class_override_property (gobject_class, 17, "button");
+ g_object_class_override_property (gobject_class, 18, "led");
+ g_object_class_override_property (gobject_class, 19, "host-ipmi");
}
/**
@@ -29100,6 +30597,18 @@
}
/**
+ * object_skeleton_set_object_mapper:
+ * @object: A #ObjectSkeleton.
+ * @interface_: (allow-none): A #ObjectMapper or %NULL to clear the interface.
+ *
+ * Sets the #ObjectMapper instance for the D-Bus interface <link linkend="gdbus-interface-org-openbmc-Object-Mapper.top_of_page">org.openbmc.Object.Mapper</link> on @object.
+ */
+void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_)
+{
+ g_object_set (G_OBJECT (object), "object-mapper", interface_, NULL);
+}
+
+/**
* object_skeleton_set_fan:
* @object: A #ObjectSkeleton.
* @interface_: (allow-none): A #Fan or %NULL to clear the interface.
@@ -29377,6 +30886,7 @@
if (g_once_init_enter (&once_init_value))
{
lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Object.Mapper", GSIZE_TO_POINTER (TYPE_OBJECT_MAPPER_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.Fan", GSIZE_TO_POINTER (TYPE_FAN_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorValue", GSIZE_TO_POINTER (TYPE_SENSOR_VALUE_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.openbmc.SensorThreshold", GSIZE_TO_POINTER (TYPE_SENSOR_THRESHOLD_PROXY));
diff --git a/interfaces/openbmc_intf.h b/interfaces/openbmc_intf.h
index af80c89..97f92b1 100644
--- a/interfaces/openbmc_intf.h
+++ b/interfaces/openbmc_intf.h
@@ -13,6 +13,139 @@
/* ------------------------------------------------------------------------ */
+/* Declarations for org.openbmc.Object.Mapper */
+
+#define TYPE_OBJECT_MAPPER (object_mapper_get_type ())
+#define OBJECT_MAPPER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MAPPER, ObjectMapper))
+#define IS_OBJECT_MAPPER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MAPPER))
+#define OBJECT_MAPPER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), TYPE_OBJECT_MAPPER, ObjectMapperIface))
+
+struct _ObjectMapper;
+typedef struct _ObjectMapper ObjectMapper;
+typedef struct _ObjectMapperIface ObjectMapperIface;
+
+struct _ObjectMapperIface
+{
+ GTypeInterface parent_iface;
+
+ void (*object_added) (
+ ObjectMapper *object,
+ const gchar *arg_object_path,
+ const gchar *arg_interface_name);
+
+};
+
+GType object_mapper_get_type (void) G_GNUC_CONST;
+
+GDBusInterfaceInfo *object_mapper_interface_info (void);
+guint object_mapper_override_properties (GObjectClass *klass, guint property_id_begin);
+
+
+/* D-Bus signal emissions functions: */
+void object_mapper_emit_object_added (
+ ObjectMapper *object,
+ const gchar *arg_object_path,
+ const gchar *arg_interface_name);
+
+
+
+/* ---- */
+
+#define TYPE_OBJECT_MAPPER_PROXY (object_mapper_proxy_get_type ())
+#define OBJECT_MAPPER_PROXY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxy))
+#define OBJECT_MAPPER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxyClass))
+#define OBJECT_MAPPER_PROXY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_MAPPER_PROXY, ObjectMapperProxyClass))
+#define IS_OBJECT_MAPPER_PROXY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MAPPER_PROXY))
+#define IS_OBJECT_MAPPER_PROXY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_MAPPER_PROXY))
+
+typedef struct _ObjectMapperProxy ObjectMapperProxy;
+typedef struct _ObjectMapperProxyClass ObjectMapperProxyClass;
+typedef struct _ObjectMapperProxyPrivate ObjectMapperProxyPrivate;
+
+struct _ObjectMapperProxy
+{
+ /*< private >*/
+ GDBusProxy parent_instance;
+ ObjectMapperProxyPrivate *priv;
+};
+
+struct _ObjectMapperProxyClass
+{
+ GDBusProxyClass parent_class;
+};
+
+GType object_mapper_proxy_get_type (void) G_GNUC_CONST;
+
+void object_mapper_proxy_new (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ObjectMapper *object_mapper_proxy_new_finish (
+ GAsyncResult *res,
+ GError **error);
+ObjectMapper *object_mapper_proxy_new_sync (
+ GDBusConnection *connection,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GError **error);
+
+void object_mapper_proxy_new_for_bus (
+ GBusType bus_type,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+ObjectMapper *object_mapper_proxy_new_for_bus_finish (
+ GAsyncResult *res,
+ GError **error);
+ObjectMapper *object_mapper_proxy_new_for_bus_sync (
+ GBusType bus_type,
+ GDBusProxyFlags flags,
+ const gchar *name,
+ const gchar *object_path,
+ GCancellable *cancellable,
+ GError **error);
+
+
+/* ---- */
+
+#define TYPE_OBJECT_MAPPER_SKELETON (object_mapper_skeleton_get_type ())
+#define OBJECT_MAPPER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeleton))
+#define OBJECT_MAPPER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeletonClass))
+#define OBJECT_MAPPER_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_OBJECT_MAPPER_SKELETON, ObjectMapperSkeletonClass))
+#define IS_OBJECT_MAPPER_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_OBJECT_MAPPER_SKELETON))
+#define IS_OBJECT_MAPPER_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_OBJECT_MAPPER_SKELETON))
+
+typedef struct _ObjectMapperSkeleton ObjectMapperSkeleton;
+typedef struct _ObjectMapperSkeletonClass ObjectMapperSkeletonClass;
+typedef struct _ObjectMapperSkeletonPrivate ObjectMapperSkeletonPrivate;
+
+struct _ObjectMapperSkeleton
+{
+ /*< private >*/
+ GDBusInterfaceSkeleton parent_instance;
+ ObjectMapperSkeletonPrivate *priv;
+};
+
+struct _ObjectMapperSkeletonClass
+{
+ GDBusInterfaceSkeletonClass parent_class;
+};
+
+GType object_mapper_skeleton_get_type (void) G_GNUC_CONST;
+
+ObjectMapper *object_mapper_skeleton_new (void);
+
+
+/* ------------------------------------------------------------------------ */
/* Declarations for org.openbmc.Fan */
#define TYPE_FAN (fan_get_type ())
@@ -1730,6 +1863,7 @@
GTypeInterface parent_iface;
+
gboolean (*handle_boot) (
ControlHost *object,
GDBusMethodInvocation *invocation);
@@ -1742,6 +1876,10 @@
ControlHost *object,
GDBusMethodInvocation *invocation);
+ gint (*get_debug_mode) (ControlHost *object);
+
+ const gchar * (*get_flash_side) (ControlHost *object);
+
void (*booted) (
ControlHost *object);
@@ -1825,6 +1963,15 @@
+/* D-Bus property accessors: */
+gint control_host_get_debug_mode (ControlHost *object);
+void control_host_set_debug_mode (ControlHost *object, gint value);
+
+const gchar *control_host_get_flash_side (ControlHost *object);
+gchar *control_host_dup_flash_side (ControlHost *object);
+void control_host_set_flash_side (ControlHost *object, const gchar *value);
+
+
/* ---- */
#define TYPE_CONTROL_HOST_PROXY (control_host_proxy_get_type ())
@@ -3086,23 +3233,25 @@
Button *object,
GDBusMethodInvocation *invocation);
- gboolean (*handle_sim_button_long_press) (
+ gboolean (*handle_sim_long_press) (
Button *object,
GDBusMethodInvocation *invocation);
- gboolean (*handle_sim_button_press) (
+ gboolean (*handle_sim_press) (
Button *object,
GDBusMethodInvocation *invocation);
gboolean (*get_state) (Button *object);
- void (*button_pressed) (
+ guint64 (*get_timer) (Button *object);
+
+ void (*pressed) (
Button *object);
- void (*button_pressed_long) (
+ void (*pressed_long) (
Button *object);
- void (*button_release) (
+ void (*released) (
Button *object);
};
@@ -3119,24 +3268,24 @@
GDBusMethodInvocation *invocation,
gboolean state);
-void button_complete_sim_button_press (
+void button_complete_sim_press (
Button *object,
GDBusMethodInvocation *invocation);
-void button_complete_sim_button_long_press (
+void button_complete_sim_long_press (
Button *object,
GDBusMethodInvocation *invocation);
/* D-Bus signal emissions functions: */
-void button_emit_button_release (
+void button_emit_released (
Button *object);
-void button_emit_button_pressed (
+void button_emit_pressed (
Button *object);
-void button_emit_button_pressed_long (
+void button_emit_pressed_long (
Button *object);
@@ -3160,34 +3309,34 @@
GCancellable *cancellable,
GError **error);
-void button_call_sim_button_press (
+void button_call_sim_press (
Button *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean button_call_sim_button_press_finish (
+gboolean button_call_sim_press_finish (
Button *proxy,
GAsyncResult *res,
GError **error);
-gboolean button_call_sim_button_press_sync (
+gboolean button_call_sim_press_sync (
Button *proxy,
GCancellable *cancellable,
GError **error);
-void button_call_sim_button_long_press (
+void button_call_sim_long_press (
Button *proxy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-gboolean button_call_sim_button_long_press_finish (
+gboolean button_call_sim_long_press_finish (
Button *proxy,
GAsyncResult *res,
GError **error);
-gboolean button_call_sim_button_long_press_sync (
+gboolean button_call_sim_long_press_sync (
Button *proxy,
GCancellable *cancellable,
GError **error);
@@ -3198,6 +3347,9 @@
gboolean button_get_state (Button *object);
void button_set_state (Button *object, gboolean value);
+guint64 button_get_timer (Button *object);
+void button_set_timer (Button *object, guint64 value);
+
/* ---- */
@@ -3332,6 +3484,8 @@
const gchar * (*get_function) (Led *object);
+ const gchar * (*get_state) (Led *object);
+
};
GType led_get_type (void) G_GNUC_CONST;
@@ -3434,6 +3588,10 @@
gchar *led_dup_function (Led *object);
void led_set_function (Led *object, const gchar *value);
+const gchar *led_get_state (Led *object);
+gchar *led_dup_state (Led *object);
+void led_set_state (Led *object, const gchar *value);
+
/* ---- */
@@ -3732,6 +3890,7 @@
GType object_get_type (void) G_GNUC_CONST;
+ObjectMapper *object_get_object_mapper (Object *object);
Fan *object_get_fan (Object *object);
SensorValue *object_get_sensor_value (Object *object);
SensorThreshold *object_get_sensor_threshold (Object *object);
@@ -3750,6 +3909,7 @@
Button *object_get_button (Object *object);
Led *object_get_led (Object *object);
HostIpmi *object_get_host_ipmi (Object *object);
+ObjectMapper *object_peek_object_mapper (Object *object);
Fan *object_peek_fan (Object *object);
SensorValue *object_peek_sensor_value (Object *object);
SensorThreshold *object_peek_sensor_threshold (Object *object);
@@ -3820,6 +3980,7 @@
GType object_skeleton_get_type (void) G_GNUC_CONST;
ObjectSkeleton *object_skeleton_new (const gchar *object_path);
+void object_skeleton_set_object_mapper (ObjectSkeleton *object, ObjectMapper *interface_);
void object_skeleton_set_fan (ObjectSkeleton *object, Fan *interface_);
void object_skeleton_set_sensor_value (ObjectSkeleton *object, SensorValue *interface_);
void object_skeleton_set_sensor_threshold (ObjectSkeleton *object, SensorThreshold *interface_);
diff --git a/objects/button_power_obj.c b/objects/button_power_obj.c
index 93005a1..f436fde 100644
--- a/objects/button_power_obj.c
+++ b/objects/button_power_obj.c
@@ -2,12 +2,13 @@
#include "interfaces/openbmc_intf.h"
#include "gpio.h"
#include "openbmc.h"
+#include "object_mapper.h"
/* ---------------------------------------------------------------------------------------------------- */
static const gchar* dbus_object_path = "/org/openbmc/buttons";
static const gchar* instance_name = "power0";
static const gchar* dbus_name = "org.openbmc.buttons.Power";
-
+static const int LONG_PRESS_SECONDS = 3;
static GDBusObjectManagerServer *manager = NULL;
//This object will use these GPIOs
@@ -29,8 +30,8 @@
GDBusMethodInvocation *invocation,
gpointer user_data)
{
- button_emit_button_pressed(btn);
- button_complete_sim_button_press(btn,invocation);
+ button_emit_pressed(btn);
+ button_complete_sim_press(btn,invocation);
return TRUE;
}
static gboolean
@@ -50,24 +51,32 @@
&error );
printf("%s\n",buf);
+ time_t current_time = time(NULL);
if (gpio_button.irq_inited)
{
Button* button = object_get_button((Object*)user_data);
if (buf[0] == '0')
{
printf("Power Button pressed\n");
- button_emit_button_pressed(button);
+ button_emit_pressed(button);
+ button_set_timer(button,(long)current_time);
}
else
{
- printf("Power Button released\n");
+ long press_time = current_time-button_get_timer(button);
+ printf("Power Button released, held for %ld seconds\n",press_time);
+ if (press_time > LONG_PRESS_SECONDS)
+ {
+ button_emit_pressed_long(button);
+ } else {
+ button_emit_released(button);
+ }
}
}
else { gpio_button.irq_inited = true; }
return TRUE;
}
-
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
@@ -87,6 +96,10 @@
object_skeleton_set_button (object, button);
g_object_unref (button);
+ ObjectMapper* mapper = object_mapper_skeleton_new ();
+ object_skeleton_set_object_mapper (object, mapper);
+ g_object_unref (mapper);
+
//define method callbacks
g_signal_connect (button,
"handle-is-on",
@@ -116,8 +129,8 @@
if (rc != GPIO_OK)
{
printf("ERROR PowerButton: GPIO setup (rc=%d)\n",rc);
- }
-
+ }
+ emit_object_added((GDBusObjectManager*)manager);
}
static void
diff --git a/objects/control_bmc_barreleye.c b/objects/control_bmc_barreleye.c
index a3a19e8..1bfb4c4 100644
--- a/objects/control_bmc_barreleye.c
+++ b/objects/control_bmc_barreleye.c
@@ -57,7 +57,7 @@
bmcreg = memmap(mem_fd,LPC_BASE);
devmem(bmcreg+LPC_HICR6,0x00000500); //Enable LPC FWH cycles, Enable LPC to AHB bridge
- devmem(bmcreg+LPC_HICR7,0x30000E00); //32M PNOR
+ devmem(bmcreg+LPC_HICR7,0x30000C00); //32M PNOR
devmem(bmcreg+LPC_HICR8,0xFC0003FF);
//flash controller
diff --git a/objects/control_host_obj.c b/objects/control_host_obj.c
index 63a8d64..672ef85 100644
--- a/objects/control_host_obj.c
+++ b/objects/control_host_obj.c
@@ -8,12 +8,12 @@
#include "interfaces/openbmc_intf.h"
#include "openbmc.h"
#include "gpio.h"
-
+#include "object_mapper.h"
/* ---------------------------------------------------------------------------------------------------- */
static const gchar* dbus_object_path = "/org/openbmc/control";
static const gchar* instance_name = "host0";
-static const gchar* dbus_name = "org.openbmc.control.Host";
+static const gchar* dbus_name = "org.openbmc.control.Host";
static GDBusObjectManagerServer *manager = NULL;
@@ -22,6 +22,25 @@
GPIO fsi_enable = (GPIO){ "FSI_ENABLE" };
GPIO cronus_sel = (GPIO){ "CRONUS_SEL" };
+/* Bit bang patterns */
+
+//putcfam pu 281c 30000000 -p0 (Primary Side Select)
+static const char* primary = "000011111111110101111000111001100111111111111111111111111111101111111111";
+//putcfam pu 281c B0000000 -p0
+static const char* go = "000011111111110101111000111000100111111111111111111111111111101101111111";
+//putcfam pu 0x281c 30900000 (Golden Side Select)
+static const char* golden = "000011111111110101111000111001100111101101111111111111111111101001111111";
+
+/* Setup attentions */
+//putcfam pu 0x081C 20000000
+static const char* attnA = "000011111111111101111110001001101111111111111111111111111111110001111111";
+//putcfam pu 0x100D 40000000
+static const char* attnB = "000011111111111011111100101001011111111111111111111111111111110001111111";
+//putcfam pu 0x100B FFFFFFFF
+static const char* attnC = "000011111111111011111101001000000000000000000000000000000000001011111111";
+
+
+
static gboolean
on_init (Control *control,
GDBusMethodInvocation *invocation,
@@ -30,70 +49,123 @@
control_complete_init(control,invocation);
return TRUE;
}
+
+int fsi_bitbang(const char* pattern)
+{
+ int rc=GPIO_OK;
+ int i;
+ for(i=0;i<strlen(pattern);i++) {
+ rc = gpio_writec(&fsi_data,pattern[i]);
+ if (rc!=GPIO_OK) { break; }
+ rc = gpio_clock_cycle(&fsi_clk,1);
+ if (rc!=GPIO_OK) { break; }
+ }
+ return rc;
+
+}
+
+int fsi_standby()
+{
+ int rc=GPIO_OK;
+ rc = gpio_write(&fsi_data,1);
+ if (rc!=GPIO_OK) { return rc; }
+ rc = gpio_clock_cycle(&fsi_clk,5000);
+ if (rc!=GPIO_OK) { return rc; }
+ return rc;
+}
+
+
static gboolean
on_boot (ControlHost *host,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
- // TODO: Add error checking
- g_print("Do Boot\n");
int rc = GPIO_OK;
+ if (control_host_get_debug_mode(host)==1)
+ {
+ g_print("Enabling debug mode; not booting host\n");
+ rc |= gpio_open(&fsi_enable);
+ rc |= gpio_open(&cronus_sel);
+ rc |= gpio_write(&fsi_enable,1);
+ rc |= gpio_write(&cronus_sel,0);
+ if (rc!=GPIO_OK) {
+ g_print("ERROR enabling debug mode: %d\n",rc);
+ }
+ return TRUE;
+ }
+ g_print("Booting host\n");
Control* control = object_get_control((Object*)user_data);
control_host_complete_boot(host,invocation);
do {
- rc |= gpio_open(&fsi_clk);
+ rc = gpio_open(&fsi_clk);
rc |= gpio_open(&fsi_data);
rc |= gpio_open(&fsi_enable);
rc |= gpio_open(&cronus_sel);
if (rc!=GPIO_OK) { break; }
-
+
+ //setup dc pins
rc = gpio_write(&cronus_sel,1);
- //putcfam pu 281c 30000000 -p0
- char a[] = "000011111111110101111000111001100111111111111111111111111111101111111111";
- //putcfam pu 281c B0000000 -p0
- char b[] = "000011111111110101111000111000100111111111111111111111111111101101111111";
+ rc |= gpio_write(&fsi_enable,1);
+ rc |= gpio_write(&fsi_clk,1);
+ if (rc!=GPIO_OK) { break; }
- gpio_write(&fsi_enable,1);
- gpio_write(&fsi_clk,1);
- gpio_write(&fsi_data,1);
- gpio_clock_cycle(&fsi_clk,5000);
- gpio_write(&fsi_data,0);
- gpio_clock_cycle(&fsi_clk,256);
- gpio_write(&fsi_data,1);
- gpio_clock_cycle(&fsi_clk,50);
- uint16_t i=0;
- for(i=0;i<strlen(a);i++) {
- gpio_writec(&fsi_data,a[i]);
- gpio_clock_cycle(&fsi_clk,1);
+ //data standy state
+ rc = fsi_standby();
+
+ //clear out pipes
+ rc |= gpio_write(&fsi_data,0);
+ rc |= gpio_clock_cycle(&fsi_clk,256);
+ rc |= gpio_write(&fsi_data,1);
+ rc |= gpio_clock_cycle(&fsi_clk,50);
+ if (rc!=GPIO_OK) { break; }
+
+ rc = fsi_bitbang(attnA);
+ rc |= fsi_standby();
+
+ rc |= fsi_bitbang(attnB);
+ rc |= fsi_standby();
+
+ rc |= fsi_bitbang(attnC);
+ rc |= fsi_standby();
+ if (rc!=GPIO_OK) { break; }
+
+ const gchar* flash_side = control_host_get_flash_side(host);
+ g_print("Using %s side of the bios flash\n",flash_side);
+ if (strcmp(flash_side,"primary")==0) {
+ rc |= fsi_bitbang(primary);
+ } else if (strcmp(flash_side,"golden") == 0) {
+ rc |= fsi_bitbang(golden);
+ } else {
+ g_print("ERROR: Invalid flash side: %s\n",flash_side);
+ rc = 0xff;
+
}
- gpio_write(&fsi_data,1); /* Data standby state */
- gpio_clock_cycle(&fsi_clk,5000);
+ rc |= fsi_standby();
+ if (rc!=GPIO_OK) { break; }
+
+ rc = fsi_bitbang(go);
- for(i=0;i<strlen(b);i++) {
- gpio_writec(&fsi_data,b[i]);
- gpio_clock_cycle(&fsi_clk,1);
- }
- gpio_write(&fsi_data,1); /* Data standby state */
- gpio_clock_cycle(&fsi_clk,2);
+ rc |= gpio_write(&fsi_data,1); /* Data standby state */
+ rc |= gpio_clock_cycle(&fsi_clk,2);
- gpio_write(&fsi_clk,0); /* hold clk low for clock mux */
- gpio_write(&fsi_enable,0);
- gpio_clock_cycle(&fsi_clk,16);
- gpio_write(&fsi_clk,0); /* Data standby state */
+ rc |= gpio_write(&fsi_clk,0); /* hold clk low for clock mux */
+ rc |= gpio_write(&fsi_enable,0);
+ rc |= gpio_clock_cycle(&fsi_clk,16);
+ rc |= gpio_write(&fsi_clk,0); /* Data standby state */
} while(0);
if (rc != GPIO_OK)
{
- printf("ERROR HostControl: GPIO sequence failed (rc=%d)\n",rc);
- }
+ g_print("ERROR HostControl: GPIO sequence failed (rc=%d)\n",rc);
+ } else {
+ control_emit_goto_system_state(control,"HOST_BOOTING");
+ }
gpio_close(&fsi_clk);
gpio_close(&fsi_data);
gpio_close(&fsi_enable);
gpio_close(&cronus_sel);
- control_emit_goto_system_state(control,"HOST_BOOTING");
-
control_host_emit_booted(host);
return TRUE;
}
@@ -108,32 +180,39 @@
cmdline *cmd = user_data;
manager = g_dbus_object_manager_server_new (dbus_object_path);
- gchar *s;
- s = g_strdup_printf ("%s/%s",dbus_object_path,instance_name);
- object = object_skeleton_new (s);
- g_free (s);
- ControlHost* control_host = control_host_skeleton_new ();
- object_skeleton_set_control_host (object, control_host);
- g_object_unref (control_host);
+ gchar *s;
+ s = g_strdup_printf ("%s/%s",dbus_object_path,instance_name);
+ object = object_skeleton_new (s);
+ g_free (s);
- Control* control = control_skeleton_new ();
- object_skeleton_set_control (object, control);
- g_object_unref (control);
+ ControlHost* control_host = control_host_skeleton_new ();
+ object_skeleton_set_control_host (object, control_host);
+ g_object_unref (control_host);
- //define method callbacks here
- g_signal_connect (control_host,
- "handle-boot",
- G_CALLBACK (on_boot),
- object); /* user_data */
+ Control* control = control_skeleton_new ();
+ object_skeleton_set_control (object, control);
+ g_object_unref (control);
- g_signal_connect (control,
- "handle-init",
- G_CALLBACK (on_init),
- NULL); /* user_data */
+ ObjectMapper* mapper = object_mapper_skeleton_new ();
+ object_skeleton_set_object_mapper (object, mapper);
+ g_object_unref (mapper);
- /* Export the object (@manager takes its own reference to @object) */
- g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
- g_object_unref (object);
+ //define method callbacks here
+ g_signal_connect (control_host,
+ "handle-boot",
+ G_CALLBACK (on_boot),
+ object); /* user_data */
+ g_signal_connect (control,
+ "handle-init",
+ G_CALLBACK (on_init),
+ NULL); /* user_data */
+
+ control_host_set_debug_mode(control_host,0);
+ control_host_set_flash_side(control_host,"primary");
+
+ /* Export the object (@manager takes its own reference to @object) */
+ g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
+ g_object_unref (object);
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
@@ -142,7 +221,7 @@
gpio_init(connection,&fsi_clk);
gpio_init(connection,&fsi_enable);
gpio_init(connection,&cronus_sel);
-
+ emit_object_added((GDBusObjectManager*)manager);
}
static void
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/led_controller.c b/objects/led_controller.c
index 29698fe..8c3fa3c 100644
--- a/objects/led_controller.c
+++ b/objects/led_controller.c
@@ -2,6 +2,7 @@
#include <stdio.h>
#include "openbmc.h"
#include "gpio.h"
+#include "object_mapper.h"
/* ---------------------------------------------------------------------------------------------------- */
static const gchar* dbus_object_path = "/org/openbmc/control/led";
@@ -31,15 +32,15 @@
if (rc != GPIO_OK) { break; }
rc = gpio_write(mygpio,0);
if (rc != GPIO_OK) { break; }
+ led_set_state(led,"on");
+
} while(0);
gpio_close(mygpio);
if (rc != GPIO_OK)
{
- printf("ERROR ledcontrol: GPIO error %s (rc=%d)\n",mygpio->name,rc);
+ g_print("ERROR ledcontrol: GPIO error %s (rc=%d)\n",mygpio->name,rc);
}
-
return TRUE;
-
}
static gboolean
@@ -56,15 +57,38 @@
if (rc != GPIO_OK) { break; }
rc = gpio_write(mygpio,1);
if (rc != GPIO_OK) { break; }
+ led_set_state(led,"off");
} while(0);
gpio_close(mygpio);
if (rc != GPIO_OK)
{
- printf("ERROR ChassisIdentify: GPIO error %s (rc=%d)\n",mygpio->name,rc);
+ g_print("ERROR led controller: GPIO error %s (rc=%d)\n",mygpio->name,rc);
}
return TRUE;
}
+void init_led(Led* led, GPIO* mygpio)
+{
+ int rc = GPIO_OK;
+ do {
+ uint8_t val;
+ rc = gpio_open(mygpio);
+ if (rc != GPIO_OK) { break; }
+ rc = gpio_read(mygpio,&val);
+ if (rc != GPIO_OK) { break; }
+ if (val == 0) {
+ led_set_state(led,"on");
+ } else {
+ led_set_state(led,"off");
+ }
+ } while(0);
+ gpio_close(mygpio);
+ if (rc != GPIO_OK) {
+ g_print("ERROR led controller: GPIO error %s (rc=%d)\n",
+ mygpio->name,rc);
+ }
+}
+
static void
on_bus_acquired (GDBusConnection *connection,
const gchar *name,
@@ -87,6 +111,10 @@
object_skeleton_set_led (object, led);
g_object_unref (led);
+ ObjectMapper* mapper = object_mapper_skeleton_new ();
+ object_skeleton_set_object_mapper (object, mapper);
+ g_object_unref (mapper);
+
//define method callbacks
g_signal_connect (led,
"handle-set-on",
@@ -101,13 +129,14 @@
led_set_function(led,led_gpio[i].name);
gpio_init(connection,&led_gpio[i]);
+ init_led(led, &led_gpio[i]);
/* Export the object (@manager takes its own reference to @object) */
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_object_unref (object);
}
/* Export all objects */
g_dbus_object_manager_server_set_connection (manager, connection);
-
+ emit_object_added((GDBusObjectManager*)manager);
}
static void
diff --git a/objects/pflash/pflash.c b/objects/pflash/pflash.c
index 031ccb2..09359fb 100644
--- a/objects/pflash/pflash.c
+++ b/objects/pflash/pflash.c
@@ -502,7 +502,7 @@
printf("\t\tThis message.\n\n");
}
-int pflash_main(int argc, char *argv[])
+int main(int argc, char *argv[])
{
const char *pname = argv[0];
uint32_t address = 0, read_size = 0, write_size = 0;
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
diff --git a/xml/openbmc_intf.xml b/xml/openbmc_intf.xml
index 4a2398f..2e0103b 100644
--- a/xml/openbmc_intf.xml
+++ b/xml/openbmc_intf.xml
@@ -1,4 +1,10 @@
<node>
+ <interface name="org.openbmc.Object.Mapper">
+ <signal name="ObjectAdded">
+ <arg name="object_path" type="s"/>
+ <arg name="interface_name" type="s"/>
+ </signal>
+ </interface>
<interface name="org.openbmc.Fan">
<method name="setCoolingZone">
<arg name="cooling_zone" type="i" direction="in"/>
@@ -102,6 +108,8 @@
<method name="boot"/>
<method name="shutdown"/>
<method name="reboot"/>
+ <property name="debug_mode" type="i" access="readwrite"/>
+ <property name="flash_side" type="s" access="readwrite"/>
<signal name="Booted"/>
</interface>
<interface name="org.openbmc.control.Power">
@@ -187,13 +195,15 @@
<method name="isOn">
<arg name="state" type="b" direction="out"/>
</method>
- <method name="simButtonPress"/>
- <method name="simButtonLongPress"/>
+ <method name="simPress"/>
+ <method name="simLongPress"/>
<property name="state" type="b" access="read"/>
- <signal name="ButtonRelease"/>
- <signal name="ButtonPressed"/>
- <signal name="ButtonPressedLong"/>
+ <signal name="Released"/>
+ <signal name="Pressed"/>
+ <signal name="PressedLong"/>
+
+ <property name="timer" type="t" access="read"/>
</interface>
<interface name="org.openbmc.Led">
<method name="setOn"/>
@@ -203,6 +213,7 @@
<property name="color" type="i" access="read"/>
<property name="function" type="s" access="read"/>
+ <property name="state" type="s" access="read"/>
</interface>
<interface name="org.openbmc.HostIpmi">
<signal name="ReceivedMessage">