Make objectPath leaf name customizable
The leaf name of objectPath is usually considered as the sensor name
(for example, phosphor-ipmi-host), so make it customizable.
Tested:
Add the preferred customName and check the status of this sensor in
command "ipmitool sdr elist" is not disable.
Signed-off-by: JinFuLin <JeffLin2@quantatw.com>
Change-Id: I4396280220a51e12e6a4d3ec74fd636ce6bb2554
diff --git a/include/error_monitors/ierr_monitor.hpp b/include/error_monitors/ierr_monitor.hpp
index c648432..374dbff 100644
--- a/include/error_monitors/ierr_monitor.hpp
+++ b/include/error_monitors/ierr_monitor.hpp
@@ -43,8 +43,6 @@
static const constexpr char* callbackMgrPath =
"/xyz/openbmc_project/CallbackManager";
- static const constexpr char* assertPath =
- "/xyz/openbmc_project/host_error_monitor/processor/IERR";
void logEvent()
{
@@ -418,7 +416,8 @@
public:
IERRMonitor(boost::asio::io_service& io,
std::shared_ptr<sdbusplus::asio::connection> conn,
- const std::string& signalName) :
+ const std::string& signalName,
+ const std::string& customName = std::string()) :
BaseGPIOPollMonitor(io, conn, signalName, assertValue,
ierrPollingTimeMs, ierrTimeoutMs)
{
@@ -456,8 +455,10 @@
[this](std::size_t& resp) { return getTimeoutMs(); });
hostErrorTimeoutIface->initialize();
+ std::string objectName = customName.empty() ? signalName : customName;
assertIERR = server.add_interface(
- assertPath, "xyz.openbmc_project.HostErrorMonitor.Processor.IERR");
+ "/xyz/openbmc_project/host_error_monitor/processor/" + objectName,
+ "xyz.openbmc_project.HostErrorMonitor.Processor.IERR");
assertIERR->register_property("Asserted", false);
assertIERR->initialize();