diff options
author | Sergey Solomin <sergey.solomin@us.ibm.com> | 2016-08-23 09:07:28 -0500 |
---|---|---|
committer | Sergey Solomin <sergey.solomin@us.ibm.com> | 2016-08-25 13:37:57 -0500 |
commit | eb9b814403895d6435e04f02a9ff6c2b1b02cf54 (patch) | |
tree | 4a1713845844f874799a1b188db209adeaa3e085 /testaddsel.cpp | |
parent | bc40c178bb0b345ed1edf553b94369330003af34 (diff) | |
download | phosphor-host-ipmid-eb9b814403895d6435e04f02a9ff6c2b1b02cf54.tar.gz phosphor-host-ipmid-eb9b814403895d6435e04f02a9ff6c2b1b02cf54.zip |
Hard-coded service name replaced with call to ObjectMapper
In the openbmc code, the dbus service name is hardcoded.
The ObjectMapper provides a way to find out the service name by
issuing a GetObject method call to the ObjectMapper.
That functionality is implemented in mapper.c
The output of the call to the mapper is a service name.
Resolves openbmc/openbmc#319.
Change-Id: I724a31ede6bdf3ae4b361e730857b1f2696a8966
Signed-off-by: Sergey Solomin <sergey.solomin@us.ibm.com>
Diffstat (limited to 'testaddsel.cpp')
-rw-r--r-- | testaddsel.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/testaddsel.cpp b/testaddsel.cpp index 202200a..9fd9d35 100644 --- a/testaddsel.cpp +++ b/testaddsel.cpp @@ -5,6 +5,7 @@ #include <stdint.h> #include <systemd/sd-bus.h> #include "sensorhandler.h" +#include <mapper.h> extern void send_esel(uint16_t recordid); @@ -16,15 +17,19 @@ sd_bus *bus = NULL; // step for mapping IPMI int find_openbmc_path(const char *type, const uint8_t num, dbus_interface_t *interface) { - const char *busname = "org.openbmc.managers.System"; const char *objname = "/org/openbmc/managers/System"; char *str1, *str2, *str3; sd_bus_error error = SD_BUS_ERROR_NULL; sd_bus_message *reply = NULL, *m=NULL; - - int r; + char *busname = NULL; + + r = mapper_get_service(bus, objname, &busname); + if (r < 0) { + fprintf(stderr, "Failed to get busname: %s\n", strerror(-r)); + goto final; + } r = sd_bus_message_new_method_call(bus,&m,busname,objname,busname,"getObjectFromByteId"); if (r < 0) { @@ -60,6 +65,7 @@ final: sd_bus_error_free(&error); sd_bus_message_unref(m); + free (busname); return r; } |