summaryrefslogtreecommitdiffstats
path: root/systemintfcmds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'systemintfcmds.cpp')
-rw-r--r--systemintfcmds.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index d044030..564cc38 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -5,10 +5,10 @@
#include "host-cmd-manager.hpp"
#include "host-interface.hpp"
-#include <ipmid/api.h>
-
#include <cstring>
#include <ipmid-host/cmd.hpp>
+#include <ipmid/api.hpp>
+#include <ipmid/registration.hpp>
void register_netfn_app_functions() __attribute__((constructor));
@@ -109,6 +109,8 @@ std::unique_ptr<phosphor::host::command::Host> host
__attribute__((init_priority(101)));
std::unique_ptr<sdbusplus::server::manager::manager> objManager
__attribute__((init_priority(101)));
+std::unique_ptr<sdbusplus::asio::connection> sdbusp
+ __attribute__((init_priority(101)));
} // namespace
#include <unistd.h>
@@ -130,14 +132,23 @@ void register_netfn_app_functions()
// Create new xyz.openbmc_project.host object on the bus
auto objPath = std::string{CONTROL_HOST_OBJ_MGR} + '/' + HOST_NAME + '0';
+ // Create a new sdbus connection so it can have a well-known name
+ sd_bus* bus = nullptr;
+ sd_bus_open_system(&bus);
+ if (!bus)
+ {
+ return;
+ }
+ auto io = getIoService();
+ sdbusp = std::make_unique<sdbusplus::asio::connection>(*io, bus);
+
// Add sdbusplus ObjectManager.
- auto& sdbusPlusHandler = ipmid_get_sdbus_plus_handler();
objManager = std::make_unique<sdbusplus::server::manager::manager>(
- *sdbusPlusHandler, CONTROL_HOST_OBJ_MGR);
+ *sdbusp, CONTROL_HOST_OBJ_MGR);
- host = std::make_unique<phosphor::host::command::Host>(*sdbusPlusHandler,
+ host = std::make_unique<phosphor::host::command::Host>(*sdbusp,
objPath.c_str());
- sdbusPlusHandler->request_name(CONTROL_HOST_BUSNAME);
+ sdbusp->request_name(CONTROL_HOST_BUSNAME);
return;
}
OpenPOWER on IntegriCloud