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