1 /*
2 // Copyright (c) 2017 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #include "DeviceMgmt.hpp"
18 #include "HwmonTempSensor.hpp"
19 #include "SensorPaths.hpp"
20 #include "Thresholds.hpp"
21 #include "Utils.hpp"
22
23 #include <boost/asio/error.hpp>
24 #include <boost/asio/io_context.hpp>
25 #include <boost/asio/post.hpp>
26 #include <boost/asio/steady_timer.hpp>
27 #include <boost/container/flat_map.hpp>
28 #include <boost/container/flat_set.hpp>
29 #include <phosphor-logging/lg2.hpp>
30 #include <phosphor-logging/lg2/flags.hpp>
31 #include <sdbusplus/asio/connection.hpp>
32 #include <sdbusplus/asio/object_server.hpp>
33 #include <sdbusplus/bus.hpp>
34 #include <sdbusplus/bus/match.hpp>
35 #include <sdbusplus/message.hpp>
36 #include <sdbusplus/message/native_types.hpp>
37
38 #include <algorithm>
39 #include <array>
40 #include <chrono>
41 #include <cstddef>
42 #include <cstdint>
43 #include <filesystem>
44 #include <functional>
45 #include <memory>
46 #include <optional>
47 #include <regex>
48 #include <string>
49 #include <system_error>
50 #include <utility>
51 #include <variant>
52 #include <vector>
53
54 static constexpr float pollRateDefault = 0.5;
55
56 static constexpr double maxValuePressure = 120000; // Pascals
57 static constexpr double minValuePressure = 30000; // Pascals
58
59 static constexpr double maxValueRelativeHumidity = 100; // PercentRH
60 static constexpr double minValueRelativeHumidity = 0; // PercentRH
61
62 static constexpr double maxValueTemperature = 127; // DegreesC
63 static constexpr double minValueTemperature = -128; // DegreesC
64
65 static const I2CDeviceTypeMap sensorTypes{
66 {"ADM1021", I2CDeviceType{"adm1021", true}},
67 {"DPS310", I2CDeviceType{"dps310", false}},
68 {"EMC1403", I2CDeviceType{"emc1403", true}},
69 {"EMC1412", I2CDeviceType{"emc1412", true}},
70 {"EMC1413", I2CDeviceType{"emc1413", true}},
71 {"EMC1414", I2CDeviceType{"emc1414", true}},
72 {"HDC1080", I2CDeviceType{"hdc1080", false}},
73 {"JC42", I2CDeviceType{"jc42", true}},
74 {"LM75A", I2CDeviceType{"lm75a", true}},
75 {"LM95234", I2CDeviceType{"lm95234", true}},
76 {"MAX31725", I2CDeviceType{"max31725", true}},
77 {"MAX31730", I2CDeviceType{"max31730", true}},
78 {"MAX6581", I2CDeviceType{"max6581", true}},
79 {"MAX6654", I2CDeviceType{"max6654", true}},
80 {"MAX6639", I2CDeviceType{"max6639", true}},
81 {"MCP9600", I2CDeviceType{"mcp9600", false}},
82 {"NCT6779", I2CDeviceType{"nct6779", true}},
83 {"NCT7802", I2CDeviceType{"nct7802", true}},
84 {"PT5161L", I2CDeviceType{"pt5161l", true}},
85 {"SBTSI", I2CDeviceType{"sbtsi", true}},
86 {"SI7020", I2CDeviceType{"si7020", false}},
87 {"TMP100", I2CDeviceType{"tmp100", true}},
88 {"TMP112", I2CDeviceType{"tmp112", true}},
89 {"TMP175", I2CDeviceType{"tmp175", true}},
90 {"TMP421", I2CDeviceType{"tmp421", true}},
91 {"TMP432", I2CDeviceType{"tmp432", true}},
92 {"TMP441", I2CDeviceType{"tmp441", true}},
93 {"TMP461", I2CDeviceType{"tmp461", true}},
94 {"TMP464", I2CDeviceType{"tmp464", true}},
95 {"TMP468", I2CDeviceType{"tmp468", true}},
96 {"TMP75", I2CDeviceType{"tmp75", true}},
97 {"W83773G", I2CDeviceType{"w83773g", true}},
98 };
99
getSensorParameters(const std::filesystem::path & path)100 static struct SensorParams getSensorParameters(
101 const std::filesystem::path& path)
102 {
103 // offset is to default to 0 and scale to 1, see lore
104 // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/
105 struct SensorParams tmpSensorParameters = {
106 .minValue = minValueTemperature,
107 .maxValue = maxValueTemperature,
108 .offsetValue = 0.0,
109 .scaleValue = 1.0,
110 .units = sensor_paths::unitDegreesC,
111 .typeName = "temperature"};
112
113 // For IIO RAW sensors we get a raw_value, an offset, and scale
114 // to compute the value = (raw_value + offset) * scale
115 // with a _raw IIO device we need to get the
116 // offsetValue and scaleValue from the driver
117 // these are used to compute the reading in
118 // units that have yet to be scaled for D-Bus.
119 const std::string pathStr = path.string();
120 if (pathStr.ends_with("_raw"))
121 {
122 std::string pathOffsetStr =
123 pathStr.substr(0, pathStr.size() - 4) + "_offset";
124 std::optional<double> tmpOffsetValue = readFile(pathOffsetStr, 1.0);
125 // In case there is nothing to read skip this device
126 // This is not an error condition see lore
127 // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/
128 if (tmpOffsetValue)
129 {
130 tmpSensorParameters.offsetValue = *tmpOffsetValue;
131 }
132
133 std::string pathScaleStr =
134 pathStr.substr(0, pathStr.size() - 4) + "_scale";
135 std::optional<double> tmpScaleValue = readFile(pathScaleStr, 1.0);
136 // In case there is nothing to read skip this device
137 // This is not an error condition see lore
138 // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/
139 if (tmpScaleValue)
140 {
141 tmpSensorParameters.scaleValue = *tmpScaleValue;
142 }
143 }
144
145 // Temperatures are read in milli degrees Celsius, we need
146 // degrees Celsius. Pressures are read in kilopascal, we need
147 // Pascals. On D-Bus for Open BMC we use the International
148 // System of Units without prefixes. Links to the kernel
149 // documentation:
150 // https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
151 // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
152 if (path.filename() == "in_pressure_input" ||
153 path.filename() == "in_pressure_raw")
154 {
155 tmpSensorParameters.minValue = minValuePressure;
156 tmpSensorParameters.maxValue = maxValuePressure;
157 // Pressures are read in kilopascal, we need Pascals.
158 tmpSensorParameters.scaleValue *= 1000.0;
159 tmpSensorParameters.typeName = "pressure";
160 tmpSensorParameters.units = sensor_paths::unitPascals;
161 }
162 else if (path.filename() == "in_humidityrelative_input" ||
163 path.filename() == "in_humidityrelative_raw")
164 {
165 tmpSensorParameters.minValue = minValueRelativeHumidity;
166 tmpSensorParameters.maxValue = maxValueRelativeHumidity;
167 // Relative Humidity are read in milli-percent, we need percent.
168 tmpSensorParameters.scaleValue *= 0.001;
169 tmpSensorParameters.typeName = "humidity";
170 tmpSensorParameters.units = sensor_paths::unitPercentRH;
171 }
172 else
173 {
174 // Temperatures are read in milli degrees Celsius,
175 // we need degrees Celsius.
176 tmpSensorParameters.scaleValue *= 0.001;
177 }
178
179 return tmpSensorParameters;
180 }
181
182 struct SensorConfigKey
183 {
184 uint64_t bus;
185 uint64_t addr;
operator <SensorConfigKey186 bool operator<(const SensorConfigKey& other) const
187 {
188 if (bus != other.bus)
189 {
190 return bus < other.bus;
191 }
192 return addr < other.addr;
193 }
194 };
195
196 struct SensorConfig
197 {
198 std::string sensorPath;
199 SensorData sensorData;
200 std::string interface;
201 SensorBaseConfigMap config;
202 std::vector<std::string> name;
203 };
204
205 using SensorConfigMap =
206 boost::container::flat_map<SensorConfigKey, SensorConfig>;
207
buildSensorConfigMap(const ManagedObjectType & sensorConfigs)208 static SensorConfigMap buildSensorConfigMap(
209 const ManagedObjectType& sensorConfigs)
210 {
211 SensorConfigMap configMap;
212 for (const auto& [path, cfgData] : sensorConfigs)
213 {
214 for (const auto& [intf, cfg] : cfgData)
215 {
216 auto busCfg = cfg.find("Bus");
217 auto addrCfg = cfg.find("Address");
218 if ((busCfg == cfg.end()) || (addrCfg == cfg.end()))
219 {
220 continue;
221 }
222
223 if ((std::get_if<uint64_t>(&busCfg->second) == nullptr) ||
224 (std::get_if<uint64_t>(&addrCfg->second) == nullptr))
225 {
226 lg2::error("'{PATH}' Bus or Address invalid", "PATH", path.str);
227 continue;
228 }
229
230 std::vector<std::string> hwmonNames;
231 auto nameCfg = cfg.find("Name");
232 if (nameCfg != cfg.end())
233 {
234 hwmonNames.push_back(std::get<std::string>(nameCfg->second));
235 size_t i = 1;
236 while (true)
237 {
238 auto sensorNameCfg = cfg.find("Name" + std::to_string(i));
239 if (sensorNameCfg == cfg.end())
240 {
241 break;
242 }
243 hwmonNames.push_back(
244 std::get<std::string>(sensorNameCfg->second));
245 i++;
246 }
247 }
248
249 SensorConfigKey key = {std::get<uint64_t>(busCfg->second),
250 std::get<uint64_t>(addrCfg->second)};
251 SensorConfig val = {path.str, cfgData, intf, cfg, hwmonNames};
252
253 auto [it, inserted] = configMap.emplace(key, std::move(val));
254 if (!inserted)
255 {
256 lg2::error(
257 "'{PATH}': ignoring duplicate entry for '{BUS}', '{ADDR}'",
258 "PATH", path.str, "BUS", key.bus, "ADDR", lg2::hex,
259 key.addr);
260 }
261 }
262 }
263 return configMap;
264 }
265
createSensors(boost::asio::io_context & io,sdbusplus::asio::object_server & objectServer,boost::container::flat_map<std::string,std::shared_ptr<HwmonTempSensor>> & sensors,std::shared_ptr<sdbusplus::asio::connection> & dbusConnection,const std::shared_ptr<boost::container::flat_set<std::string>> & sensorsChanged,bool activateOnly)266 void createSensors(
267 boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
268 boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>&
269 sensors,
270 std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
271 const std::shared_ptr<boost::container::flat_set<std::string>>&
272 sensorsChanged,
273 bool activateOnly)
274 {
275 auto getter = std::make_shared<GetSensorConfiguration>(
276 dbusConnection,
277 [&io, &objectServer, &sensors, &dbusConnection, sensorsChanged,
278 activateOnly](const ManagedObjectType& sensorConfigurations) {
279 bool firstScan = sensorsChanged == nullptr;
280
281 SensorConfigMap configMap =
282 buildSensorConfigMap(sensorConfigurations);
283
284 auto devices =
285 instantiateDevices(sensorConfigurations, sensors, sensorTypes);
286
287 // IIO _raw devices look like this on sysfs:
288 // /sys/bus/iio/devices/iio:device0/in_temp_raw
289 // /sys/bus/iio/devices/iio:device0/in_temp_offset
290 // /sys/bus/iio/devices/iio:device0/in_temp_scale
291 //
292 // Other IIO devices look like this on sysfs:
293 // /sys/bus/iio/devices/iio:device1/in_temp_input
294 // /sys/bus/iio/devices/iio:device1/in_pressure_input
295 std::vector<std::filesystem::path> paths;
296 std::filesystem::path root("/sys/bus/iio/devices");
297 findFiles(root, R"(in_temp\d*_(input|raw))", paths);
298 findFiles(root, R"(in_pressure\d*_(input|raw))", paths);
299 findFiles(root, R"(in_humidityrelative\d*_(input|raw))", paths);
300 findFiles(std::filesystem::path("/sys/class/hwmon"),
301 R"(temp\d+_input)", paths);
302
303 // iterate through all found temp and pressure sensors,
304 // and try to match them with configuration
305 for (auto& path : paths)
306 {
307 std::smatch match;
308 const std::string pathStr = path.string();
309 auto directory = path.parent_path();
310 std::filesystem::path device;
311
312 std::string deviceName;
313 std::error_code ec;
314 if (pathStr.starts_with("/sys/bus/iio/devices"))
315 {
316 device = std::filesystem::canonical(directory, ec);
317 if (ec)
318 {
319 lg2::error("Fail to find device in '{PATH}'", "PATH",
320 pathStr);
321 continue;
322 }
323 deviceName = device.parent_path().stem();
324 }
325 else
326 {
327 device =
328 std::filesystem::canonical(directory / "device", ec);
329 if (ec)
330 {
331 lg2::error("Fail to find device in '{PATH}'", "PATH",
332 pathStr);
333 continue;
334 }
335 deviceName = device.stem();
336 }
337
338 uint64_t bus = 0;
339 uint64_t addr = 0;
340 if (!getDeviceBusAddr(deviceName, bus, addr))
341 {
342 continue;
343 }
344
345 auto thisSensorParameters = getSensorParameters(path);
346 auto findSensorCfg = configMap.find({bus, addr});
347 if (findSensorCfg == configMap.end())
348 {
349 continue;
350 }
351
352 const std::string& interfacePath =
353 findSensorCfg->second.sensorPath;
354 auto findI2CDev = devices.find(interfacePath);
355
356 std::shared_ptr<I2CDevice> i2cDev;
357 if (findI2CDev != devices.end())
358 {
359 // If we're only looking to activate newly-instantiated i2c
360 // devices and this sensor's underlying device was already
361 // there before this call, there's nothing more to do here.
362 if (activateOnly && !findI2CDev->second.second)
363 {
364 continue;
365 }
366 i2cDev = findI2CDev->second.first;
367 }
368
369 const SensorData& sensorData = findSensorCfg->second.sensorData;
370 std::string sensorType = findSensorCfg->second.interface;
371 auto pos = sensorType.find_last_of('.');
372 if (pos != std::string::npos)
373 {
374 sensorType = sensorType.substr(pos + 1);
375 }
376 const SensorBaseConfigMap& baseConfigMap =
377 findSensorCfg->second.config;
378 std::vector<std::string>& hwmonName =
379 findSensorCfg->second.name;
380
381 // Temperature has "Name", pressure has "Name1"
382 auto findSensorName = baseConfigMap.find("Name");
383 int index = 1;
384 if (thisSensorParameters.typeName == "pressure" ||
385 thisSensorParameters.typeName == "humidity")
386 {
387 findSensorName = baseConfigMap.find("Name1");
388 index = 2;
389 }
390
391 if (findSensorName == baseConfigMap.end())
392 {
393 lg2::error(
394 "could not determine configuration name for '{NAME}'",
395 "NAME", deviceName);
396 continue;
397 }
398 std::string sensorName =
399 std::get<std::string>(findSensorName->second);
400 // on rescans, only update sensors we were signaled by
401 auto findSensor = sensors.find(sensorName);
402 if (!firstScan && findSensor != sensors.end())
403 {
404 bool found = false;
405 auto it = sensorsChanged->begin();
406 while (it != sensorsChanged->end())
407 {
408 if (it->ends_with(findSensor->second->name))
409 {
410 it = sensorsChanged->erase(it);
411 findSensor->second = nullptr;
412 found = true;
413 break;
414 }
415 ++it;
416 }
417 if (!found)
418 {
419 continue;
420 }
421 }
422
423 std::vector<thresholds::Threshold> sensorThresholds;
424
425 if (!parseThresholdsFromConfig(sensorData, sensorThresholds,
426 nullptr, &index))
427 {
428 lg2::error("error populating thresholds for "
429 "'{NAME}', index: '{INDEX}'",
430 "NAME", sensorName, "INDEX", index);
431 }
432
433 float pollRate = getPollRate(baseConfigMap, pollRateDefault);
434 PowerState readState = getPowerState(baseConfigMap);
435
436 auto permitSet = getPermitSet(baseConfigMap);
437 auto& sensor = sensors[sensorName];
438 if (!activateOnly)
439 {
440 sensor = nullptr;
441 }
442 auto hwmonFile = getFullHwmonFilePath(directory.string(),
443 "temp1", permitSet);
444 if (pathStr.starts_with("/sys/bus/iio/devices"))
445 {
446 hwmonFile = pathStr;
447 }
448 if (hwmonFile)
449 {
450 if (sensor != nullptr)
451 {
452 sensor->activate(*hwmonFile, i2cDev);
453 }
454 else
455 {
456 sensor = std::make_shared<HwmonTempSensor>(
457 *hwmonFile, sensorType, objectServer,
458 dbusConnection, io, sensorName,
459 std::move(sensorThresholds), thisSensorParameters,
460 pollRate, interfacePath, readState, i2cDev);
461 sensor->setupRead();
462 }
463 }
464 hwmonName.erase(
465 remove(hwmonName.begin(), hwmonName.end(), sensorName),
466 hwmonName.end());
467
468 // Looking for keys like "Name1" for temp2_input,
469 // "Name2" for temp3_input, etc.
470 int i = 0;
471 while (true)
472 {
473 ++i;
474 auto findKey =
475 baseConfigMap.find("Name" + std::to_string(i));
476 if (findKey == baseConfigMap.end())
477 {
478 break;
479 }
480 std::string sensorName =
481 std::get<std::string>(findKey->second);
482 hwmonFile = getFullHwmonFilePath(
483 directory.string(), "temp" + std::to_string(i + 1),
484 permitSet);
485 if (pathStr.starts_with("/sys/bus/iio/devices"))
486 {
487 continue;
488 }
489 if (hwmonFile)
490 {
491 // To look up thresholds for these additional sensors,
492 // match on the Index property in the threshold data
493 // where the index comes from the sysfs file we're on,
494 // i.e. index = 2 for temp2_input.
495 int index = i + 1;
496 std::vector<thresholds::Threshold> thresholds;
497
498 if (!parseThresholdsFromConfig(sensorData, thresholds,
499 nullptr, &index))
500 {
501 lg2::error("error populating thresholds for "
502 "'{NAME}', index: '{INDEX}'",
503 "NAME", sensorName, "INDEX", index);
504 }
505
506 auto& sensor = sensors[sensorName];
507 if (!activateOnly)
508 {
509 sensor = nullptr;
510 }
511
512 if (sensor != nullptr)
513 {
514 sensor->activate(*hwmonFile, i2cDev);
515 }
516 else
517 {
518 sensor = std::make_shared<HwmonTempSensor>(
519 *hwmonFile, sensorType, objectServer,
520 dbusConnection, io, sensorName,
521 std::move(thresholds), thisSensorParameters,
522 pollRate, interfacePath, readState, i2cDev);
523 sensor->setupRead();
524 }
525 }
526
527 hwmonName.erase(
528 remove(hwmonName.begin(), hwmonName.end(), sensorName),
529 hwmonName.end());
530 }
531 if (hwmonName.empty())
532 {
533 configMap.erase(findSensorCfg);
534 }
535 }
536 });
537 std::vector<std::string> types(sensorTypes.size());
538 for (const auto& [type, dt] : sensorTypes)
539 {
540 types.push_back(type);
541 }
542 getter->getConfiguration(types);
543 }
544
interfaceRemoved(sdbusplus::message_t & message,boost::container::flat_map<std::string,std::shared_ptr<HwmonTempSensor>> & sensors)545 void interfaceRemoved(
546 sdbusplus::message_t& message,
547 boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>&
548 sensors)
549 {
550 if (message.is_method_error())
551 {
552 lg2::error("interfacesRemoved callback method error");
553 return;
554 }
555
556 sdbusplus::message::object_path path;
557 std::vector<std::string> interfaces;
558
559 message.read(path, interfaces);
560
561 // If the xyz.openbmc_project.Confguration.X interface was removed
562 // for one or more sensors, delete those sensor objects.
563 auto sensorIt = sensors.begin();
564 while (sensorIt != sensors.end())
565 {
566 if (sensorIt->second && (sensorIt->second->configurationPath == path) &&
567 (std::find(interfaces.begin(), interfaces.end(),
568 sensorIt->second->configInterface) != interfaces.end()))
569 {
570 sensorIt = sensors.erase(sensorIt);
571 }
572 else
573 {
574 sensorIt++;
575 }
576 }
577 }
578
powerStateChanged(PowerState type,bool newState,boost::container::flat_map<std::string,std::shared_ptr<HwmonTempSensor>> & sensors,boost::asio::io_context & io,sdbusplus::asio::object_server & objectServer,std::shared_ptr<sdbusplus::asio::connection> & dbusConnection)579 static void powerStateChanged(
580 PowerState type, bool newState,
581 boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>&
582 sensors,
583 boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
584 std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
585 {
586 if (newState)
587 {
588 createSensors(io, objectServer, sensors, dbusConnection, nullptr, true);
589 }
590 else
591 {
592 for (auto& [path, sensor] : sensors)
593 {
594 if (sensor != nullptr && sensor->readState == type)
595 {
596 sensor->deactivate();
597 }
598 }
599 }
600 }
601
main()602 int main()
603 {
604 boost::asio::io_context io;
605 auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
606 sdbusplus::asio::object_server objectServer(systemBus, true);
607 objectServer.add_manager("/xyz/openbmc_project/sensors");
608 systemBus->request_name("xyz.openbmc_project.HwmonTempSensor");
609
610 boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>
611 sensors;
612 auto sensorsChanged =
613 std::make_shared<boost::container::flat_set<std::string>>();
614
615 auto powerCallBack = [&sensors, &io, &objectServer,
616 &systemBus](PowerState type, bool state) {
617 powerStateChanged(type, state, sensors, io, objectServer, systemBus);
618 };
619 setupPowerMatchCallback(systemBus, powerCallBack);
620
621 boost::asio::post(io, [&]() {
622 createSensors(io, objectServer, sensors, systemBus, nullptr, false);
623 });
624
625 boost::asio::steady_timer filterTimer(io);
626 std::function<void(sdbusplus::message_t&)> eventHandler =
627 [&](sdbusplus::message_t& message) {
628 if (message.is_method_error())
629 {
630 lg2::error("callback method error");
631 return;
632 }
633 sensorsChanged->insert(message.get_path());
634 // this implicitly cancels the timer
635 filterTimer.expires_after(std::chrono::seconds(1));
636
637 filterTimer.async_wait([&](const boost::system::error_code& ec) {
638 if (ec == boost::asio::error::operation_aborted)
639 {
640 /* we were canceled*/
641 return;
642 }
643 if (ec)
644 {
645 lg2::error("timer error");
646 return;
647 }
648 createSensors(io, objectServer, sensors, systemBus,
649 sensorsChanged, false);
650 });
651 };
652
653 std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches =
654 setupPropertiesChangedMatches(*systemBus, sensorTypes, eventHandler);
655 setupManufacturingModeMatch(*systemBus);
656
657 // Watch for entity-manager to remove configuration interfaces
658 // so the corresponding sensors can be removed.
659 auto ifaceRemovedMatch = std::make_unique<sdbusplus::bus::match_t>(
660 static_cast<sdbusplus::bus_t&>(*systemBus),
661 "type='signal',member='InterfacesRemoved',arg0path='" +
662 std::string(inventoryPath) + "/'",
663 [&sensors](sdbusplus::message_t& msg) {
664 interfaceRemoved(msg, sensors);
665 });
666
667 matches.emplace_back(std::move(ifaceRemovedMatch));
668
669 io.run();
670 }
671