gpio-presence: Support for multiple iface assocs
This will allow additional interfaces to be specified
to associate with inventory items to allow for further
customization of inventory items.
Specifying property values for an interface added this way
is currently not supported.
Tested: Verified any given interface(s) is associated properly
Signed-off-by: Anthony Wilson <wilsonan@us.ibm.com>
Change-Id: I99e655b35120c82454a8851201218ec548ad9fe3
diff --git a/presence/main.cpp b/presence/main.cpp
index 16866d4..eace07e 100644
--- a/presence/main.cpp
+++ b/presence/main.cpp
@@ -64,6 +64,7 @@
auto key = options["key"];
auto path = options["path"];
auto drivers = options["drivers"];
+ auto ifaces = options["extra-ifaces"];
if (argc < 4)
{
std::cerr << "Too few arguments\n";
@@ -99,6 +100,19 @@
}
}
+ std::vector<Interface> ifaceList;
+
+ // Extra interfaces list is optional
+ if (ifaces != ArgumentParser::emptyString)
+ {
+ std::stringstream ss(ifaces);
+ Interface iface;
+ while (std::getline(ss, iface, ','))
+ {
+ ifaceList.push_back(iface);
+ }
+ }
+
auto bus = sdbusplus::bus::new_default();
auto rc = 0;
sd_event* event = nullptr;
@@ -113,7 +127,7 @@
auto name = options["name"];
Presence presence(bus, inventory, path, std::stoul(key), name, eventP,
- driverList);
+ driverList, ifaceList);
while (true)
{