zone: Add debug interface to zone dbus path
- Add xyz.openbmc_project.Debug.Pid.Zone interface to fanctrl/zoneX dbus
to record the PID config name which is driving this zone.
TEST:
```
busctl introspect xyz.openbmc_project.State.FanCtrl /xyz/openbmc_project/settings/fanctrl/zone0 xyz.openbmc_project.Debug.Pid.Zone
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Leader property s "CPU0_PID" emits-change
```
Signed-off-by: Harvey Wu <Harvey.Wu@quantatw.com>
Change-Id: I6fcfa596eec6b51a7727c2a01e7d36e3698eebcf
diff --git a/pid/zone.cpp b/pid/zone.cpp
index a8c388a..995b2aa 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -516,4 +516,9 @@
_pidsFailSafePercent[name] = percent;
}
+std::string DbusPidZone::leader() const
+{
+ return _maximumSetPointName;
+}
+
} // namespace pid_control
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 53d90fd..85a9064 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -11,6 +11,7 @@
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Control/Mode/server.hpp>
+#include <xyz/openbmc_project/Debug/Pid/Zone/server.hpp>
#include <xyz/openbmc_project/Object/Enable/server.hpp>
#include <fstream>
@@ -24,7 +25,9 @@
template <typename... T>
using ServerObject = typename sdbusplus::server::object_t<T...>;
using ModeInterface = sdbusplus::xyz::openbmc_project::Control::server::Mode;
-using ModeObject = ServerObject<ModeInterface>;
+using DebugZoneInterface =
+ sdbusplus::xyz::openbmc_project::Debug::Pid::server::Zone;
+using ModeObject = ServerObject<ModeInterface, DebugZoneInterface>;
using ProcessInterface =
sdbusplus::xyz::openbmc_project::Object::server::Enable;
using ProcessObject = ServerObject<ProcessInterface>;
@@ -102,6 +105,8 @@
bool manual(bool value) override;
/* Method for reading whether in fail-safe mode over dbus */
bool failSafe() const override;
+ /* Method for recording the maximum SetPoint PID config name */
+ std::string leader() const override;
/* Method for control process for each loop at runtime */
void addPidControlProcess(std::string name, sdbusplus::bus_t& bus,
std::string objPath, bool defer);
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 8c55a70..391d026 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -26,6 +26,7 @@
using ::testing::StrEq;
static std::string modeInterface = "xyz.openbmc_project.Control.Mode";
+static std::string debugZoneInterface = "xyz.openbmc_project.Debug.Pid.Zone";
static std::string enableInterface = "xyz.openbmc_project.Object.Enable";
namespace
@@ -60,6 +61,8 @@
std::vector<std::string> properties;
SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface, properties,
&d);
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath, debugZoneInterface,
+ properties, &d);
std::string sensorname = "temp1";
std::string pidsensorpath = "/xyz/openbmc_project/settings/fanctrl/zone1/" +
@@ -100,6 +103,8 @@
SetupDbusObject(&sdbus_mock_mode, defer, objPath, modeInterface,
properties, &property_index);
+ SetupDbusObject(&sdbus_mock_mode, defer, objPath, debugZoneInterface,
+ properties, &property_index);
SetupDbusObject(&sdbus_mock_enable, defer, pidsensorpath.c_str(),
enableInterface, propertiesenable,