diff options
Diffstat (limited to 'meta-phosphor')
10 files changed, 0 insertions, 349 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/examples/files/obmc-phosphor-example-pydbus.py b/meta-phosphor/common/recipes-phosphor/examples/files/obmc-phosphor-example-pydbus.py deleted file mode 100644 index 1f4ce90bb..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/files/obmc-phosphor-example-pydbus.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python - -# Contributors Listed Below - COPYRIGHT 2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. - -import sys -import dbus -import dbus.service -import dbus.mainloop.glib -import gobject - -SERVICE_PREFIX = 'org.openbmc.examples' -IFACE_PREFIX = 'org.openbmc.examples' -BASE_OBJ_PATH = '/org/openbmc/examples/' - -class SampleObjectOne(dbus.service.Object): - def __init__(self, bus, name): - super(SampleObjectOne, self).__init__(bus, name) - - @dbus.service.method(IFACE_PREFIX + '.Echo', 's', 's') - def Echo(self, val): - self.MethodInvoked("Echo method was invoked", self._object_path) - return self._object_path + " says " + val - - @dbus.service.signal(IFACE_PREFIX + '.Echo', 'ss') - def MethodInvoked(self, message, path): - pass - -class SampleObjectTwo(SampleObjectOne): - def __init__(self, bus, name): - super(SampleObjectTwo, self).__init__(bus, name) - self.map = { 'empty' : 'add values to me' } - - @dbus.service.signal(IFACE_PREFIX + '.Dict', 'sss') - def DictMethodCalled(self, message, key, value): - pass - - @dbus.service.method(IFACE_PREFIX + '.Dict', 'ss', '') - def SetAValueInTheDict(self, key, value): - self.DictMethodCalled("Dict method was invoked", key, value) - self.map[key] = value - - @dbus.service.method(IFACE_PREFIX + '.Dict', 's', 's') - def GetAValueFromTheDict(self, key): - return self.map.get(key, "set a value first") - - @dbus.service.method(IFACE_PREFIX + '.Dict', '', 's') - def GetAllValuesFromTheDict(self): - return " ".join( [ x+ ':' + self.map[x] for x in self.map.keys() ] ) - - @dbus.service.method(dbus.PROPERTIES_IFACE, 'ss', 'v') - def Get(self, interface, prop): - return self.GetAll(interface)[prop] - - @dbus.service.method(dbus.PROPERTIES_IFACE, 's', 'a{sv}') - def GetAll(self, interface): - if interface == IFACE_PREFIX + '.Dict': - return { 'Dict': self.map } - - @dbus.service.method(dbus.PROPERTIES_IFACE, 'ssv') - def Set(self, interface, prop, value): - if prop == 'Dict': - self.map = value - self.PropertiesChanged(interface, { prop : value }, []) - - @dbus.service.signal(dbus.PROPERTIES_IFACE, 'sa{sv}as') - def PropertiesChanged(self, interface, properties, invalidated_properties): - pass - -if __name__ == '__main__': - dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) - - bus = dbus.SystemBus() - - services = [] - services.append(dbus.service.BusName(SERVICE_PREFIX + '.PythonService', bus)) - - objs = [] - objs.append(SampleObjectOne(bus, BASE_OBJ_PATH + 'path0/PythonObj')) - objs.append(SampleObjectTwo(bus, BASE_OBJ_PATH + 'path1/PythonObj')) - - mainloop = gobject.MainLoop() - - print "obmc-phosphor-example-pydbus starting..." - mainloop.run() - diff --git a/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.conf b/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.conf deleted file mode 100644 index 6c4a71314..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.conf +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <policy user="root"> - <allow own="org.openbmc.examples.PythonService"/> - <allow send_destination="org.openbmc.examples.PythonService"/> - </policy> -</busconfig> diff --git a/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.service b/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.service deleted file mode 100644 index 0b1a68fcd..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/files/org.openbmc.examples.PythonService.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=Phosphor Python Application Example - -[Service] -Restart=always -ExecStart={sbindir}/obmc-phosphor-example-pydbus -Environment="PYTHONUNBUFFERED=1" - -[Install] -WantedBy={SYSTEMD_DEFAULT_TARGET} diff --git a/meta-phosphor/common/recipes-phosphor/examples/files/pyclient-sample.py b/meta-phosphor/common/recipes-phosphor/examples/files/pyclient-sample.py deleted file mode 100644 index 138865db0..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/files/pyclient-sample.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -# Contributors Listed Below - COPYRIGHT 2015 -# [+] International Business Machines Corp. -# -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. - -import dbus -import dbus.service -import dbus.mainloop.glib -import gobject - -SERVICE_PREFIX = 'org.openbmc.examples' -IFACE_PREFIX = 'org.openbmc.examples' -BASE_OBJ_PATH = '/org/openbmc/examples/' - -def signal_callback(*a, **kw): - print "Got signal:" - print "intf: " + kw.get('intf', 'none') - print "path: " + kw.get('path', 'none') - print "member: " + kw.get('member', 'none') - -if __name__ == '__main__': - dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) - - bus = dbus.SystemBus() - - obj0 = bus.get_object(SERVICE_PREFIX + '.PythonService', - BASE_OBJ_PATH + 'path0/PythonObj') - obj1 = bus.get_object(SERVICE_PREFIX + '.PythonService', - BASE_OBJ_PATH + 'path1/PythonObj') - echo0= dbus.Interface(obj0, - dbus_interface=IFACE_PREFIX + '.Echo') - echo1= dbus.Interface(obj0, - dbus_interface=IFACE_PREFIX + '.Echo') - - print "Invoking Echo methods...." - print(echo0.Echo("hello")) - print(echo1.Echo("there")) - - bus.add_signal_receiver(signal_callback, interface_keyword = 'intf', - path_keyword = 'path', - member_keyword = 'member') - - print "Waiting for signals... (call a sample method to see something here)" - print "Press Ctrl^C to quit" - mainloop = gobject.MainLoop() - - mainloop.run() diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-pydbus.bb b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-pydbus.bb deleted file mode 100644 index a6c513dda..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-pydbus.bb +++ /dev/null @@ -1,17 +0,0 @@ -SUMMARY = "Phosphor OpenBMC BSP Example Application" -DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation." -PR = "r1" - -DBUS_SERVICE_${PN} += "org.openbmc.examples.PythonService.service" - -inherit obmc-phosphor-pydbus-service - -client = "pyclient-sample" -SRC_URI += "file://${client}.py" -SRC_URI += "file://${PN}.py" -S = "${WORKDIR}" - -do_install_append() { - install -d ${D}${bindir} - install -m 0755 ${S}/${client}.py ${D}${bindir}/${client} -} diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus.bb b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus.bb deleted file mode 100644 index a19b6848f..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus.bb +++ /dev/null @@ -1,12 +0,0 @@ -SUMMARY = "Phosphor OpenBMC BSP Example Application" -DESCRIPTION = "Phosphor OpenBMC QEMU BSP example implementation." -PR = "r1" - -DBUS_SERVICE_${PN} += "org.openbmc.examples.SDBusService.service" - -S = "${WORKDIR}" -SRC_URI += "file://Makefile \ - file://obmc-phosphor-example-sdbus.c \ - " -inherit obmc-phosphor-sdbus-service -inherit obmc-phosphor-c-daemon diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/Makefile b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/Makefile deleted file mode 100644 index 0aaeb5341..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -EXE = obmc-phosphor-example-sdbus -OBJS = $(EXE).o -DEPPKGS = libsystemd -CC ?= $(CROSS_COMPILE)gcc -INCLUDES += $(shell pkg-config --cflags $(DEPPKGS)) -LIBS += $(shell pkg-config --libs $(DEPPKGS)) - -%.o : %.c - $(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@ -$(EXE): $(OBJS) - $(CC) $^ $(LDFLAGS) $(LIBS) -o $@ -clean: - rm -f $(OBJS) $(EXE) *.o *.d -distclean: clean - rm -f *.c~ *.h~ *.sh~ Makefile~ config.mk~ diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.c b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.c deleted file mode 100644 index 769a2081f..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/obmc-phosphor-example-sdbus.c +++ /dev/null @@ -1,111 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <errno.h> -#include <systemd/sd-bus.h> - -static int method_echo(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { - char *str; - const char *intf = sd_bus_message_get_interface(m), - *path = sd_bus_message_get_path(m); - sd_bus *bus = sd_bus_message_get_bus(m); - - char response[512] = {0}; - int r; - - /* Read the parameters */ - r = sd_bus_message_read(m, "s", &str); - if (r < 0) { - fprintf(stderr, "Failed to parse parameters: %s\n", strerror(-r)); - return r; - } - - r = sd_bus_emit_signal(bus, path, intf, "MethodInvoked", "ss", - "Echo method was invoked", path); - if (r < 0) { - fprintf(stderr, "Failed to emit signal: %s\n", strerror(-r)); - return r; - } - - strncat(response, path, 128); - strcat(response, " says "); - strncat(response, str, 128); - - /* Reply with the response */ - return sd_bus_reply_method_return(m, "s", &response); -} - -static const sd_bus_vtable echo_vtable[] = { - SD_BUS_VTABLE_START(0), - SD_BUS_METHOD("Echo", "s", "s", method_echo, SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_SIGNAL("MethodInvoked", "s", 0), - SD_BUS_VTABLE_END -}; - -int main(int argc, char *argv[]) { - sd_bus_slot *slot = NULL; - sd_bus *bus = NULL; - int r; - char **acquired = NULL, **activatable = NULL, **i; - - /* Connect to the user bus this time */ - r = sd_bus_open_system(&bus); - if (r < 0) { - fprintf(stderr, "Failed to connect to system bus: %s\n", strerror(-r)); - goto finish; - } - - /* Install an object */ - r = sd_bus_add_object_vtable(bus, - &slot, - "/org/openbmc/examples/path0/SDBusObj", /* object path */ - "org.openbmc.examples.Echo", /* interface name */ - echo_vtable, - NULL); - if (r < 0) { - fprintf(stderr, "Failed to issue method call: %s\n", strerror(-r)); - goto finish; - } - - /* Install an object */ - r = sd_bus_add_object_vtable(bus, - &slot, - "/org/openbmc/examples/path1/SDBusObj", /* object path */ - "org.openbmc.examples.Echo", /* interface name */ - echo_vtable, - NULL); - if (r < 0) { - fprintf(stderr, "Failed to issue method call: %s\n", strerror(-r)); - goto finish; - } - - /* Take a well-known service name so that clients can find us */ - r = sd_bus_request_name(bus, "org.openbmc.examples.SDBusService", 0); - if (r < 0) { - fprintf(stderr, "Failed to acquire service name: %s\n", strerror(-r)); - goto finish; - } - - for (;;) { - /* Process requests */ - r = sd_bus_process(bus, NULL); - if (r < 0) { - fprintf(stderr, "Failed to process bus: %s\n", strerror(-r)); - goto finish; - } - if (r > 0) /* we processed a request, try to process another one, right-away */ - continue; - - /* Wait for the next request to process */ - r = sd_bus_wait(bus, (uint64_t) -1); - if (r < 0) { - fprintf(stderr, "Failed to wait on bus: %s\n", strerror(-r)); - goto finish; - } - } - -finish: - sd_bus_slot_unref(slot); - sd_bus_unref(bus); - - return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS; -} diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.conf b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.conf deleted file mode 100644 index 86e2a53fa..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.conf +++ /dev/null @@ -1,8 +0,0 @@ -<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" - "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> -<busconfig> - <policy user="root"> - <allow own="org.openbmc.examples.SDBusService"/> - <allow send_destination="org.openbmc.examples.SDBusService"/> - </policy> -</busconfig> diff --git a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.service b/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.service deleted file mode 100644 index 5ef15718b..000000000 --- a/meta-phosphor/common/recipes-phosphor/examples/obmc-phosphor-example-sdbus/org.openbmc.examples.SDBusService.service +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=Phosphor SDBus Application Example - -[Service] -Restart=always -ExecStart={sbindir}/obmc-phosphor-example-sdbus - -[Install] -WantedBy={SYSTEMD_DEFAULT_TARGET} |