mctp: add I3CMCTPDDevice Assignment
This commit adds the assignment of I3CMCTPDDevice to MCTPEndpoint.
Tested on yosemite4, which is a multihost platform with 8 server blades,
mctpreactor may associate these endpoint with EM configs properly.
Change-Id: I4f8038f539245b43ba3c9ac923ccad9670aed87f
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
diff --git a/src/mctp/MCTPReactorMain.cpp b/src/mctp/MCTPReactorMain.cpp
index 5d453d2..6d33349 100644
--- a/src/mctp/MCTPReactorMain.cpp
+++ b/src/mctp/MCTPReactorMain.cpp
@@ -80,11 +80,19 @@
try
{
std::optional<SensorBaseConfigMap> iface;
- // NOLINTNEXTLINE(bugprone-assignment-in-if-condition)
- if ((iface = I2CMCTPDDevice::match(config)))
+ iface = I2CMCTPDDevice::match(config);
+ if (iface)
{
+ info("Creating I2CMCTPDDevice");
return I2CMCTPDDevice::from(connection, *iface);
}
+
+ iface = I3CMCTPDDevice::match(config);
+ if (iface)
+ {
+ info("Creating I3CMCTPDDevice");
+ return I3CMCTPDDevice::from(connection, *iface);
+ }
}
catch (const std::invalid_argument& ex)
{
@@ -125,7 +133,7 @@
msg.unpack<sdbusplus::message::object_path, std::set<std::string>>();
try
{
- if (I2CMCTPDDevice::match(removed))
+ if (I2CMCTPDDevice::match(removed) || I3CMCTPDDevice::match(removed))
{
reactor->unmanageMCTPDevice(path.str);
}
@@ -240,7 +248,7 @@
boost::asio::post(io, [reactor, systemBus]() {
auto gsc = std::make_shared<GetSensorConfiguration>(
systemBus, std::bind_front(manageMCTPEntity, systemBus, reactor));
- gsc->getConfiguration({"MCTPI2CTarget"});
+ gsc->getConfiguration({"MCTPI2CTarget", "MCTPI3CTarget"});
});
io.run();