utils: remove DBus method
Since all DBus methods have been implemented in ipmid and
iei-ipmi-oem depends on ipmid, this commit removes utils and uses
ipmid's DBus methods.
Change-Id: Ibcf45292065da544632d8fdb1990c2935d819084
Signed-off-by: George Liu <liuxiwei@ieisystem.com>
diff --git a/src/iei_oem.cpp b/src/iei_oem.cpp
index bffab0f..625bbff 100644
--- a/src/iei_oem.cpp
+++ b/src/iei_oem.cpp
@@ -2,12 +2,10 @@
#include "iei_oem.hpp"
-#include "sdbus_wrapper.hpp"
-#include "utils.hpp"
-
-#include <ipmid/api.h>
-
+#include <ipmid/api.hpp>
+#include <ipmid/utils.hpp>
#include <phosphor-logging/lg2.hpp>
+#include <sdbusplus/bus.hpp>
#include <optional>
@@ -35,7 +33,6 @@
using namespace iei;
static void registerOEMFunctions() __attribute__((constructor));
-static auto& bus = getBus();
struct ParsedAssetInfo
{
@@ -134,10 +131,19 @@
data.data() + FIRMWARE_BUILDTIME_OFFSET),
FIRMWARE_BUILDTIME_SIZE);
- // Set BIOS version
- auto service = utils::getService(bus, BIOS_OBJPATH, VERSION_IFACE);
- utils::setProperty(bus, service.c_str(), BIOS_OBJPATH, VERSION_IFACE,
- VERSION, version);
+ try
+ {
+ // Set BIOS version
+ std::shared_ptr<sdbusplus::asio::connection> dbus = getSdBus();
+ auto service = getService(*dbus, VERSION_IFACE, BIOS_OBJPATH);
+ setDbusProperty(*dbus, service, BIOS_OBJPATH, VERSION_IFACE,
+ VERSION, version);
+ }
+ catch (const std::exception& e)
+ {
+ lg2::error("Failed to set BIOS version: {VERSION}, error: {ERROR}",
+ "VERSION", version, "ERROR", e);
+ }
}
printf("Dev %s, version %s, build time %s\n",