Remove Configuration interface prefix from utils APIs
This eliminates some repetitive verbosity from daemons that handle a lot
of different sensor types (such as hwmontempsensor and psusensor). It
also positions us to more cleanly use a single data structure for both
existing APIs like GetSensorConfiguration() and
setupPropertiesChangedMatches(), as well as upcoming I2C
device-management support.
Tested: hwmontempsensor and adcsensor on romed8hm3 continue to behave as
they did previously.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Change-Id: I9d80475ca4160c8d2ff0afab942709496d51238d
diff --git a/src/IntrusionSensorMain.cpp b/src/IntrusionSensorMain.cpp
index f85b1a6..f46254f 100644
--- a/src/IntrusionSensorMain.cpp
+++ b/src/IntrusionSensorMain.cpp
@@ -43,9 +43,8 @@
static constexpr bool debug = false;
-static constexpr const char* sensorType =
- "xyz.openbmc_project.Configuration.ChassisIntrusionSensor";
-static constexpr const char* nicType = "xyz.openbmc_project.Configuration.NIC";
+static constexpr const char* sensorType = "ChassisIntrusionSensor";
+static constexpr const char* nicType = "NIC";
static constexpr auto nicTypes{std::to_array<const char*>({nicType})};
namespace fs = std::filesystem;
@@ -77,7 +76,7 @@
sensorData = &cfgData;
// match sensor type
- auto sensorBase = sensorData->find(sensorType);
+ auto sensorBase = sensorData->find(configInterfaceName(sensorType));
if (sensorBase == sensorData->end())
{
std::cerr << "error finding base configuration \n";
@@ -188,7 +187,7 @@
baseConfiguration = nullptr;
// find base configuration
- auto sensorBase = cfgData.find(nicType);
+ auto sensorBase = cfgData.find(configInterfaceName(nicType));
if (sensorBase == cfgData.end())
{
continue;
@@ -473,8 +472,8 @@
sdbusplus::bus::match_t lanConfigMatch(
static_cast<sdbusplus::bus_t&>(*systemBus),
"type='signal', member='PropertiesChanged',path_namespace='" +
- std::string(inventoryPath) + "',arg0namespace='" + nicType +
- "'",
+ std::string(inventoryPath) + "',arg0namespace='" +
+ configInterfaceName(nicType) + "'",
[&systemBus](sdbusplus::message_t& msg) {
if (msg.is_method_error())
{