diff options
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; } |