Identify active sensors via the D-Bus "sensors" service
Upstream modified how sensors are organized on D-Bus. Sensors are now
mapped under the /xyz/openbmc_project/sensors object. Each service
retrieves sensor data via a GetManagedObject call.
Tested:
busctl call -j xyz.openbmc_project.$sensor /xyz/openbmc_project/sensors \
org.freedesktop.DBus.ObjectManager GetManagedObjects
ipmitool sdr dump sdrs.bin
Confirmed neither function resulted in an error message in the journal
Change-Id: I3a41ea2c28b34c9e28abe2f16f6c325ec715dd27
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/src/ExitAirTempSensor.cpp b/src/ExitAirTempSensor.cpp
index eb816e8..7f947e5 100644
--- a/src/ExitAirTempSensor.cpp
+++ b/src/ExitAirTempSensor.cpp
@@ -931,8 +931,9 @@
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors");
systemBus->request_name("xyz.openbmc_project.ExitAirTempSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
std::shared_ptr<ExitAirTempSensor> sensor =
nullptr; // wait until we find the config
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index 463ada3..1351456 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -231,7 +231,8 @@
boost::asio::io_service io;
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
systemBus->request_name("xyz.openbmc_project.NVMeSensor");
- sdbusplus::asio::object_server objectServer(systemBus);
+ sdbusplus::asio::object_server objectServer(systemBus, true);
+ objectServer.add_manager("/xyz/openbmc_project/sensors/");
io.post([&]() { createSensors(io, objectServer, systemBus); });