James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 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 | |
Andrew Jeffery | e73bd0a | 2023-01-25 10:39:57 +1030 | [diff] [blame] | 17 | #include "DeviceMgmt.hpp" |
| 18 | #include "HwmonTempSensor.hpp" |
| 19 | #include "Utils.hpp" |
| 20 | |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 21 | #include <boost/algorithm/string/replace.hpp> |
Patrick Venture | 96e97db | 2019-10-31 13:44:38 -0700 | [diff] [blame] | 22 | #include <boost/container/flat_map.hpp> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 23 | #include <boost/container/flat_set.hpp> |
James Feist | 38fb598 | 2020-05-28 10:09:54 -0700 | [diff] [blame] | 24 | #include <sdbusplus/asio/connection.hpp> |
| 25 | #include <sdbusplus/asio/object_server.hpp> |
| 26 | #include <sdbusplus/bus/match.hpp> |
| 27 | |
| 28 | #include <array> |
Jae Hyun Yoo | 7dd6443 | 2022-03-30 14:28:33 -0700 | [diff] [blame] | 29 | #include <charconv> |
James Feist | 24f02f2 | 2019-04-15 11:05:39 -0700 | [diff] [blame] | 30 | #include <filesystem> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 31 | #include <fstream> |
Patrick Venture | 96e97db | 2019-10-31 13:44:38 -0700 | [diff] [blame] | 32 | #include <functional> |
| 33 | #include <memory> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 34 | #include <regex> |
Patrick Venture | 96e97db | 2019-10-31 13:44:38 -0700 | [diff] [blame] | 35 | #include <stdexcept> |
| 36 | #include <string> |
| 37 | #include <utility> |
| 38 | #include <variant> |
| 39 | #include <vector> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 40 | |
Jeff Lin | 87bc67f | 2020-12-04 20:58:01 +0800 | [diff] [blame] | 41 | static constexpr float pollRateDefault = 0.5; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 42 | |
Zhikui Ren | cb359da | 2023-08-03 16:45:44 -0700 | [diff] [blame^] | 43 | static constexpr double maxValuePressure = 120000; // Pascals |
| 44 | static constexpr double minValuePressure = 30000; // Pascals |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 45 | |
Bruce Mitchell | 3ec41c5 | 2021-12-10 16:05:17 -0600 | [diff] [blame] | 46 | static constexpr double maxValueRelativeHumidity = 100; // PercentRH |
| 47 | static constexpr double minValueRelativeHumidity = 0; // PercentRH |
| 48 | |
Zhikui Ren | cb359da | 2023-08-03 16:45:44 -0700 | [diff] [blame^] | 49 | static constexpr double maxValueTemperature = 127; // DegreesC |
| 50 | static constexpr double minValueTemperature = -128; // DegreesC |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 51 | |
James Feist | cf3bce6 | 2019-01-08 10:07:19 -0800 | [diff] [blame] | 52 | namespace fs = std::filesystem; |
Zev Weiss | d29f8aa | 2022-08-03 16:24:59 -0700 | [diff] [blame] | 53 | |
| 54 | static const I2CDeviceTypeMap sensorTypes{ |
| 55 | {"DPS310", I2CDeviceType{"dps310", false}}, |
| 56 | {"EMC1412", I2CDeviceType{"emc1412", true}}, |
| 57 | {"EMC1413", I2CDeviceType{"emc1413", true}}, |
| 58 | {"EMC1414", I2CDeviceType{"emc1414", true}}, |
| 59 | {"HDC1080", I2CDeviceType{"hdc1080", false}}, |
| 60 | {"JC42", I2CDeviceType{"jc42", true}}, |
| 61 | {"LM75A", I2CDeviceType{"lm75a", true}}, |
| 62 | {"LM95234", I2CDeviceType{"lm95234", true}}, |
| 63 | {"MAX31725", I2CDeviceType{"max31725", true}}, |
| 64 | {"MAX31730", I2CDeviceType{"max31730", true}}, |
| 65 | {"MAX6581", I2CDeviceType{"max6581", true}}, |
| 66 | {"MAX6654", I2CDeviceType{"max6654", true}}, |
| 67 | {"NCT6779", I2CDeviceType{"nct6779", true}}, |
| 68 | {"NCT7802", I2CDeviceType{"nct7802", true}}, |
| 69 | {"SBTSI", I2CDeviceType{"sbtsi", true}}, |
| 70 | {"SI7020", I2CDeviceType{"si7020", false}}, |
Tim Lee | 9b0a6f6 | 2022-12-23 14:47:02 +0800 | [diff] [blame] | 71 | {"TMP100", I2CDeviceType{"tmp100", true}}, |
Zev Weiss | d29f8aa | 2022-08-03 16:24:59 -0700 | [diff] [blame] | 72 | {"TMP112", I2CDeviceType{"tmp112", true}}, |
| 73 | {"TMP175", I2CDeviceType{"tmp175", true}}, |
| 74 | {"TMP421", I2CDeviceType{"tmp421", true}}, |
| 75 | {"TMP441", I2CDeviceType{"tmp441", true}}, |
Hieu Huynh | 9a7db6a | 2023-06-19 11:02:07 +0000 | [diff] [blame] | 76 | {"TMP464", I2CDeviceType{"tmp464", true}}, |
Zev Weiss | d29f8aa | 2022-08-03 16:24:59 -0700 | [diff] [blame] | 77 | {"TMP75", I2CDeviceType{"tmp75", true}}, |
| 78 | {"W83773G", I2CDeviceType{"w83773g", true}}, |
| 79 | }; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 80 | |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 81 | static struct SensorParams |
| 82 | getSensorParameters(const std::filesystem::path& path) |
| 83 | { |
| 84 | // offset is to default to 0 and scale to 1, see lore |
| 85 | // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/ |
Patrick Williams | 779c96a | 2023-05-10 07:50:42 -0500 | [diff] [blame] | 86 | struct SensorParams tmpSensorParameters = { |
| 87 | .minValue = minValueTemperature, |
| 88 | .maxValue = maxValueTemperature, |
| 89 | .offsetValue = 0.0, |
| 90 | .scaleValue = 1.0, |
| 91 | .units = sensor_paths::unitDegreesC, |
| 92 | .typeName = "temperature"}; |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 93 | |
| 94 | // For IIO RAW sensors we get a raw_value, an offset, and scale |
| 95 | // to compute the value = (raw_value + offset) * scale |
| 96 | // with a _raw IIO device we need to get the |
| 97 | // offsetValue and scaleValue from the driver |
| 98 | // these are used to compute the reading in |
| 99 | // units that have yet to be scaled for D-Bus. |
| 100 | const std::string pathStr = path.string(); |
| 101 | if (pathStr.ends_with("_raw")) |
| 102 | { |
Patrick Williams | 779c96a | 2023-05-10 07:50:42 -0500 | [diff] [blame] | 103 | std::string pathOffsetStr = pathStr.substr(0, pathStr.size() - 4) + |
| 104 | "_offset"; |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 105 | std::optional<double> tmpOffsetValue = readFile(pathOffsetStr, 1.0); |
| 106 | // In case there is nothing to read skip this device |
| 107 | // This is not an error condition see lore |
| 108 | // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/ |
| 109 | if (tmpOffsetValue) |
| 110 | { |
| 111 | tmpSensorParameters.offsetValue = *tmpOffsetValue; |
| 112 | } |
| 113 | |
Patrick Williams | 779c96a | 2023-05-10 07:50:42 -0500 | [diff] [blame] | 114 | std::string pathScaleStr = pathStr.substr(0, pathStr.size() - 4) + |
| 115 | "_scale"; |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 116 | std::optional<double> tmpScaleValue = readFile(pathScaleStr, 1.0); |
| 117 | // In case there is nothing to read skip this device |
| 118 | // This is not an error condition see lore |
| 119 | // https://lore.kernel.org/linux-iio/5c79425f-6e88-36b6-cdfe-4080738d039f@metafoo.de/ |
| 120 | if (tmpScaleValue) |
| 121 | { |
| 122 | tmpSensorParameters.scaleValue = *tmpScaleValue; |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | // Temperatures are read in milli degrees Celsius, we need |
| 127 | // degrees Celsius. Pressures are read in kilopascal, we need |
| 128 | // Pascals. On D-Bus for Open BMC we use the International |
| 129 | // System of Units without prefixes. Links to the kernel |
| 130 | // documentation: |
| 131 | // https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface |
| 132 | // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio |
| 133 | if (path.filename() == "in_pressure_input" || |
| 134 | path.filename() == "in_pressure_raw") |
| 135 | { |
| 136 | tmpSensorParameters.minValue = minValuePressure; |
| 137 | tmpSensorParameters.maxValue = maxValuePressure; |
| 138 | // Pressures are read in kilopascal, we need Pascals. |
| 139 | tmpSensorParameters.scaleValue *= 1000.0; |
| 140 | tmpSensorParameters.typeName = "pressure"; |
Bruce Mitchell | 5a86e56 | 2021-12-10 12:26:22 -0600 | [diff] [blame] | 141 | tmpSensorParameters.units = sensor_paths::unitPascals; |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 142 | } |
Bruce Mitchell | 3ec41c5 | 2021-12-10 16:05:17 -0600 | [diff] [blame] | 143 | else if (path.filename() == "in_humidityrelative_input" || |
| 144 | path.filename() == "in_humidityrelative_raw") |
| 145 | { |
| 146 | tmpSensorParameters.minValue = minValueRelativeHumidity; |
| 147 | tmpSensorParameters.maxValue = maxValueRelativeHumidity; |
| 148 | // Relative Humidity are read in milli-percent, we need percent. |
| 149 | tmpSensorParameters.scaleValue *= 0.001; |
| 150 | tmpSensorParameters.typeName = "humidity"; |
| 151 | tmpSensorParameters.units = "PercentRH"; |
| 152 | } |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 153 | else |
| 154 | { |
| 155 | // Temperatures are read in milli degrees Celsius, |
| 156 | // we need degrees Celsius. |
| 157 | tmpSensorParameters.scaleValue *= 0.001; |
| 158 | } |
| 159 | |
| 160 | return tmpSensorParameters; |
| 161 | } |
| 162 | |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 163 | struct SensorConfigKey |
| 164 | { |
| 165 | uint64_t bus; |
| 166 | uint64_t addr; |
| 167 | bool operator<(const SensorConfigKey& other) const |
| 168 | { |
| 169 | if (bus != other.bus) |
| 170 | { |
| 171 | return bus < other.bus; |
| 172 | } |
| 173 | return addr < other.addr; |
| 174 | } |
| 175 | }; |
| 176 | |
| 177 | struct SensorConfig |
| 178 | { |
| 179 | std::string sensorPath; |
| 180 | SensorData sensorData; |
| 181 | std::string interface; |
| 182 | SensorBaseConfigMap config; |
| 183 | std::vector<std::string> name; |
| 184 | }; |
| 185 | |
| 186 | using SensorConfigMap = |
| 187 | boost::container::flat_map<SensorConfigKey, SensorConfig>; |
| 188 | |
| 189 | static SensorConfigMap |
| 190 | buildSensorConfigMap(const ManagedObjectType& sensorConfigs) |
| 191 | { |
| 192 | SensorConfigMap configMap; |
Zev Weiss | a180833 | 2022-08-12 18:21:01 -0700 | [diff] [blame] | 193 | for (const auto& [path, cfgData] : sensorConfigs) |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 194 | { |
Zev Weiss | a180833 | 2022-08-12 18:21:01 -0700 | [diff] [blame] | 195 | for (const auto& [intf, cfg] : cfgData) |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 196 | { |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 197 | auto busCfg = cfg.find("Bus"); |
| 198 | auto addrCfg = cfg.find("Address"); |
| 199 | if ((busCfg == cfg.end()) || (addrCfg == cfg.end())) |
| 200 | { |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 201 | continue; |
| 202 | } |
| 203 | |
Ed Tanous | 2049bd2 | 2022-07-09 07:20:26 -0700 | [diff] [blame] | 204 | if ((std::get_if<uint64_t>(&busCfg->second) == nullptr) || |
| 205 | (std::get_if<uint64_t>(&addrCfg->second) == nullptr)) |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 206 | { |
Zev Weiss | a180833 | 2022-08-12 18:21:01 -0700 | [diff] [blame] | 207 | std::cerr << path.str << " Bus or Address invalid\n"; |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 208 | continue; |
| 209 | } |
| 210 | |
| 211 | std::vector<std::string> hwmonNames; |
| 212 | auto nameCfg = cfg.find("Name"); |
| 213 | if (nameCfg != cfg.end()) |
| 214 | { |
| 215 | hwmonNames.push_back(std::get<std::string>(nameCfg->second)); |
| 216 | size_t i = 1; |
| 217 | while (true) |
| 218 | { |
| 219 | auto sensorNameCfg = cfg.find("Name" + std::to_string(i)); |
| 220 | if (sensorNameCfg == cfg.end()) |
| 221 | { |
| 222 | break; |
| 223 | } |
| 224 | hwmonNames.push_back( |
| 225 | std::get<std::string>(sensorNameCfg->second)); |
| 226 | i++; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | SensorConfigKey key = {std::get<uint64_t>(busCfg->second), |
| 231 | std::get<uint64_t>(addrCfg->second)}; |
Zev Weiss | a180833 | 2022-08-12 18:21:01 -0700 | [diff] [blame] | 232 | SensorConfig val = {path.str, cfgData, intf, cfg, hwmonNames}; |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 233 | |
| 234 | auto [it, inserted] = configMap.emplace(key, std::move(val)); |
| 235 | if (!inserted) |
| 236 | { |
Zev Weiss | a180833 | 2022-08-12 18:21:01 -0700 | [diff] [blame] | 237 | std::cerr << path.str << ": ignoring duplicate entry for {" |
| 238 | << key.bus << ", 0x" << std::hex << key.addr |
| 239 | << std::dec << "}\n"; |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 240 | } |
| 241 | } |
| 242 | } |
| 243 | return configMap; |
| 244 | } |
| 245 | |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 246 | // returns a {path: <I2CDevice, is_new>} map. is_new indicates if the I2CDevice |
| 247 | // is newly instantiated by this call (true) or was already there (false). |
| 248 | boost::container::flat_map<std::string, |
| 249 | std::pair<std::shared_ptr<I2CDevice>, bool>> |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 250 | instantiateDevices( |
| 251 | const ManagedObjectType& sensorConfigs, |
| 252 | const boost::container::flat_map< |
| 253 | std::string, std::shared_ptr<HwmonTempSensor>>& sensors) |
| 254 | { |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 255 | boost::container::flat_map<std::string, |
| 256 | std::pair<std::shared_ptr<I2CDevice>, bool>> |
| 257 | devices; |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 258 | for (const auto& [path, sensor] : sensorConfigs) |
| 259 | { |
| 260 | for (const auto& [name, cfg] : sensor) |
| 261 | { |
| 262 | PowerState powerState = getPowerState(cfg); |
| 263 | if (!readingStateGood(powerState)) |
| 264 | { |
| 265 | continue; |
| 266 | } |
| 267 | |
| 268 | auto findSensorName = cfg.find("Name"); |
| 269 | if (findSensorName == cfg.end()) |
| 270 | { |
| 271 | continue; |
| 272 | } |
| 273 | std::string sensorName = |
| 274 | std::get<std::string>(findSensorName->second); |
| 275 | |
| 276 | auto findSensor = sensors.find(sensorName); |
| 277 | if (findSensor != sensors.end() && findSensor->second != nullptr && |
| 278 | findSensor->second->isActive()) |
| 279 | { |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 280 | devices.emplace( |
| 281 | path.str, |
| 282 | std::make_pair(findSensor->second->getI2CDevice(), false)); |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 283 | continue; |
| 284 | } |
| 285 | |
| 286 | std::optional<I2CDeviceParams> params = |
| 287 | getI2CDeviceParams(sensorTypes, cfg); |
| 288 | if (params.has_value() && !params->deviceStatic()) |
| 289 | { |
| 290 | // There exist error cases in which a sensor device that we |
| 291 | // need is already instantiated, but needs to be destroyed and |
| 292 | // re-created in order to be useful (for example if we crash |
| 293 | // after instantiating a device and the sensor device's power |
| 294 | // is cut before we get restarted, leaving it "present" but |
| 295 | // not really usable). To be on the safe side, instantiate a |
| 296 | // temporary device that's immediately destroyed so as to |
| 297 | // ensure that we end up with a fresh instance of it. |
| 298 | if (params->devicePresent()) |
| 299 | { |
| 300 | std::cerr << "Clearing out previous instance for " |
| 301 | << path.str << "\n"; |
| 302 | I2CDevice tmp(*params); |
| 303 | } |
| 304 | |
| 305 | try |
| 306 | { |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 307 | devices.emplace( |
| 308 | path.str, |
| 309 | std::make_pair(std::make_shared<I2CDevice>(*params), |
| 310 | true)); |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 311 | } |
| 312 | catch (std::runtime_error&) |
| 313 | { |
| 314 | std::cerr << "Failed to instantiate " << params->type->name |
| 315 | << " at address " << params->address << " on bus " |
| 316 | << params->bus << "\n"; |
| 317 | } |
| 318 | } |
| 319 | } |
| 320 | } |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 321 | return devices; |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 322 | } |
| 323 | |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 324 | void createSensors( |
Ed Tanous | 1f97863 | 2023-02-28 18:16:39 -0800 | [diff] [blame] | 325 | boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer, |
Yong Li | f3fd191 | 2020-03-25 21:35:23 +0800 | [diff] [blame] | 326 | boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>& |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 327 | sensors, |
| 328 | std::shared_ptr<sdbusplus::asio::connection>& dbusConnection, |
James Feist | 5591cf08 | 2020-07-15 16:44:54 -0700 | [diff] [blame] | 329 | const std::shared_ptr<boost::container::flat_set<std::string>>& |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 330 | sensorsChanged, |
| 331 | bool activateOnly) |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 332 | { |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 333 | auto getter = std::make_shared<GetSensorConfiguration>( |
| 334 | dbusConnection, |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 335 | [&io, &objectServer, &sensors, &dbusConnection, sensorsChanged, |
| 336 | activateOnly](const ManagedObjectType& sensorConfigurations) { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 337 | bool firstScan = sensorsChanged == nullptr; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 338 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 339 | SensorConfigMap configMap = buildSensorConfigMap(sensorConfigurations); |
Jayashree Dhanapal | 9f3a74e | 2022-01-06 12:05:06 +0530 | [diff] [blame] | 340 | |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 341 | auto devices = instantiateDevices(sensorConfigurations, sensors); |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 342 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 343 | // IIO _raw devices look like this on sysfs: |
| 344 | // /sys/bus/iio/devices/iio:device0/in_temp_raw |
| 345 | // /sys/bus/iio/devices/iio:device0/in_temp_offset |
| 346 | // /sys/bus/iio/devices/iio:device0/in_temp_scale |
| 347 | // |
| 348 | // Other IIO devices look like this on sysfs: |
| 349 | // /sys/bus/iio/devices/iio:device1/in_temp_input |
| 350 | // /sys/bus/iio/devices/iio:device1/in_pressure_input |
| 351 | std::vector<fs::path> paths; |
| 352 | fs::path root("/sys/bus/iio/devices"); |
| 353 | findFiles(root, R"(in_temp\d*_(input|raw))", paths); |
| 354 | findFiles(root, R"(in_pressure\d*_(input|raw))", paths); |
| 355 | findFiles(root, R"(in_humidityrelative\d*_(input|raw))", paths); |
| 356 | findFiles(fs::path("/sys/class/hwmon"), R"(temp\d+_input)", paths); |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 357 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 358 | // iterate through all found temp and pressure sensors, |
| 359 | // and try to match them with configuration |
| 360 | for (auto& path : paths) |
| 361 | { |
| 362 | std::smatch match; |
| 363 | const std::string pathStr = path.string(); |
| 364 | auto directory = path.parent_path(); |
| 365 | fs::path device; |
| 366 | |
| 367 | std::string deviceName; |
| 368 | if (pathStr.starts_with("/sys/bus/iio/devices")) |
James Feist | 37266ca | 2018-10-15 15:56:28 -0700 | [diff] [blame] | 369 | { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 370 | device = fs::canonical(directory); |
| 371 | deviceName = device.parent_path().stem(); |
| 372 | } |
| 373 | else |
| 374 | { |
| 375 | device = directory / "device"; |
| 376 | deviceName = fs::canonical(device).stem(); |
| 377 | } |
| 378 | auto findHyphen = deviceName.find('-'); |
| 379 | if (findHyphen == std::string::npos) |
| 380 | { |
| 381 | std::cerr << "found bad device " << deviceName << "\n"; |
| 382 | continue; |
| 383 | } |
| 384 | std::string busStr = deviceName.substr(0, findHyphen); |
| 385 | std::string addrStr = deviceName.substr(findHyphen + 1); |
| 386 | |
| 387 | uint64_t bus = 0; |
| 388 | uint64_t addr = 0; |
Ed Tanous | 2049bd2 | 2022-07-09 07:20:26 -0700 | [diff] [blame] | 389 | std::from_chars_result res{}; |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 390 | res = std::from_chars(busStr.data(), busStr.data() + busStr.size(), |
| 391 | bus); |
| 392 | if (res.ec != std::errc{}) |
| 393 | { |
| 394 | continue; |
| 395 | } |
| 396 | res = std::from_chars(addrStr.data(), |
| 397 | addrStr.data() + addrStr.size(), addr, 16); |
| 398 | if (res.ec != std::errc{}) |
| 399 | { |
| 400 | continue; |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 401 | } |
| 402 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 403 | auto thisSensorParameters = getSensorParameters(path); |
| 404 | auto findSensorCfg = configMap.find({bus, addr}); |
| 405 | if (findSensorCfg == configMap.end()) |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 406 | { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 407 | continue; |
| 408 | } |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 409 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 410 | const std::string& interfacePath = findSensorCfg->second.sensorPath; |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 411 | auto findI2CDev = devices.find(interfacePath); |
| 412 | |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 413 | std::shared_ptr<I2CDevice> i2cDev; |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 414 | if (findI2CDev != devices.end()) |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 415 | { |
Joseph Fu | 9bbeff7 | 2022-12-05 19:09:16 +0800 | [diff] [blame] | 416 | // If we're only looking to activate newly-instantiated i2c |
| 417 | // devices and this sensor's underlying device was already there |
| 418 | // before this call, there's nothing more to do here. |
| 419 | if (activateOnly && !findI2CDev->second.second) |
| 420 | { |
| 421 | continue; |
| 422 | } |
Zev Weiss | 7627c86 | 2022-11-17 14:23:04 -0800 | [diff] [blame] | 423 | i2cDev = findI2CDev->second.first; |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 424 | } |
| 425 | |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 426 | const SensorData& sensorData = findSensorCfg->second.sensorData; |
Matt Spinler | 0489ec2 | 2023-06-05 15:08:59 -0500 | [diff] [blame] | 427 | std::string sensorType = findSensorCfg->second.interface; |
| 428 | auto pos = sensorType.find_last_of('.'); |
| 429 | if (pos != std::string::npos) |
| 430 | { |
| 431 | sensorType = sensorType.substr(pos + 1); |
| 432 | } |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 433 | const SensorBaseConfigMap& baseConfigMap = |
| 434 | findSensorCfg->second.config; |
| 435 | std::vector<std::string>& hwmonName = findSensorCfg->second.name; |
| 436 | |
| 437 | // Temperature has "Name", pressure has "Name1" |
| 438 | auto findSensorName = baseConfigMap.find("Name"); |
| 439 | int index = 1; |
| 440 | if (thisSensorParameters.typeName == "pressure" || |
| 441 | thisSensorParameters.typeName == "humidity") |
| 442 | { |
| 443 | findSensorName = baseConfigMap.find("Name1"); |
| 444 | index = 2; |
| 445 | } |
| 446 | |
| 447 | if (findSensorName == baseConfigMap.end()) |
| 448 | { |
| 449 | std::cerr << "could not determine configuration name for " |
| 450 | << deviceName << "\n"; |
| 451 | continue; |
| 452 | } |
| 453 | std::string sensorName = |
| 454 | std::get<std::string>(findSensorName->second); |
| 455 | // on rescans, only update sensors we were signaled by |
| 456 | auto findSensor = sensors.find(sensorName); |
| 457 | if (!firstScan && findSensor != sensors.end()) |
| 458 | { |
| 459 | bool found = false; |
| 460 | auto it = sensorsChanged->begin(); |
| 461 | while (it != sensorsChanged->end()) |
| 462 | { |
Zev Weiss | 6c106d6 | 2022-08-17 20:50:00 -0700 | [diff] [blame] | 463 | if (it->ends_with(findSensor->second->name)) |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 464 | { |
| 465 | it = sensorsChanged->erase(it); |
| 466 | findSensor->second = nullptr; |
| 467 | found = true; |
| 468 | break; |
| 469 | } |
| 470 | ++it; |
| 471 | } |
| 472 | if (!found) |
| 473 | { |
| 474 | continue; |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | std::vector<thresholds::Threshold> sensorThresholds; |
| 479 | |
| 480 | if (!parseThresholdsFromConfig(sensorData, sensorThresholds, |
| 481 | nullptr, &index)) |
| 482 | { |
| 483 | std::cerr << "error populating thresholds for " << sensorName |
| 484 | << " index " << index << "\n"; |
| 485 | } |
| 486 | |
Zev Weiss | 8569bf2 | 2022-10-11 15:37:44 -0700 | [diff] [blame] | 487 | float pollRate = getPollRate(baseConfigMap, pollRateDefault); |
Zev Weiss | a4d2768 | 2022-07-19 15:30:36 -0700 | [diff] [blame] | 488 | PowerState readState = getPowerState(baseConfigMap); |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 489 | |
| 490 | auto permitSet = getPermitSet(baseConfigMap); |
| 491 | auto& sensor = sensors[sensorName]; |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 492 | if (!activateOnly) |
| 493 | { |
| 494 | sensor = nullptr; |
| 495 | } |
Patrick Williams | 779c96a | 2023-05-10 07:50:42 -0500 | [diff] [blame] | 496 | auto hwmonFile = getFullHwmonFilePath(directory.string(), "temp1", |
| 497 | permitSet); |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 498 | if (pathStr.starts_with("/sys/bus/iio/devices")) |
| 499 | { |
| 500 | hwmonFile = pathStr; |
| 501 | } |
| 502 | if (hwmonFile) |
| 503 | { |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 504 | if (sensor != nullptr) |
| 505 | { |
| 506 | sensor->activate(*hwmonFile, i2cDev); |
| 507 | } |
| 508 | else |
| 509 | { |
| 510 | sensor = std::make_shared<HwmonTempSensor>( |
| 511 | *hwmonFile, sensorType, objectServer, dbusConnection, |
| 512 | io, sensorName, std::move(sensorThresholds), |
| 513 | thisSensorParameters, pollRate, interfacePath, |
| 514 | readState, i2cDev); |
| 515 | sensor->setupRead(); |
| 516 | } |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 517 | } |
| 518 | hwmonName.erase( |
| 519 | remove(hwmonName.begin(), hwmonName.end(), sensorName), |
| 520 | hwmonName.end()); |
| 521 | |
| 522 | // Looking for keys like "Name1" for temp2_input, |
| 523 | // "Name2" for temp3_input, etc. |
| 524 | int i = 0; |
| 525 | while (true) |
| 526 | { |
| 527 | ++i; |
| 528 | auto findKey = baseConfigMap.find("Name" + std::to_string(i)); |
| 529 | if (findKey == baseConfigMap.end()) |
| 530 | { |
| 531 | break; |
| 532 | } |
| 533 | std::string sensorName = std::get<std::string>(findKey->second); |
| 534 | hwmonFile = getFullHwmonFilePath(directory.string(), |
| 535 | "temp" + std::to_string(i + 1), |
| 536 | permitSet); |
Bruce Mitchell | 544e7dc | 2021-07-29 18:05:49 -0500 | [diff] [blame] | 537 | if (pathStr.starts_with("/sys/bus/iio/devices")) |
James Feist | 37266ca | 2018-10-15 15:56:28 -0700 | [diff] [blame] | 538 | { |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 539 | continue; |
| 540 | } |
Jason Ling | 100c20b | 2020-08-11 14:50:33 -0700 | [diff] [blame] | 541 | if (hwmonFile) |
| 542 | { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 543 | // To look up thresholds for these additional sensors, |
| 544 | // match on the Index property in the threshold data |
| 545 | // where the index comes from the sysfs file we're on, |
| 546 | // i.e. index = 2 for temp2_input. |
| 547 | int index = i + 1; |
| 548 | std::vector<thresholds::Threshold> thresholds; |
| 549 | |
| 550 | if (!parseThresholdsFromConfig(sensorData, thresholds, |
| 551 | nullptr, &index)) |
| 552 | { |
| 553 | std::cerr << "error populating thresholds for " |
| 554 | << sensorName << " index " << index << "\n"; |
| 555 | } |
| 556 | |
| 557 | auto& sensor = sensors[sensorName]; |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 558 | if (!activateOnly) |
| 559 | { |
| 560 | sensor = nullptr; |
| 561 | } |
| 562 | |
| 563 | if (sensor != nullptr) |
| 564 | { |
| 565 | sensor->activate(*hwmonFile, i2cDev); |
| 566 | } |
| 567 | else |
| 568 | { |
| 569 | sensor = std::make_shared<HwmonTempSensor>( |
| 570 | *hwmonFile, sensorType, objectServer, |
| 571 | dbusConnection, io, sensorName, |
| 572 | std::move(thresholds), thisSensorParameters, |
| 573 | pollRate, interfacePath, readState, i2cDev); |
| 574 | sensor->setupRead(); |
| 575 | } |
Jason Ling | 100c20b | 2020-08-11 14:50:33 -0700 | [diff] [blame] | 576 | } |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 577 | |
Willy Tu | 9eb0cc3 | 2022-04-06 11:03:32 -0700 | [diff] [blame] | 578 | hwmonName.erase( |
| 579 | remove(hwmonName.begin(), hwmonName.end(), sensorName), |
| 580 | hwmonName.end()); |
James Feist | df51515 | 2019-09-18 16:40:40 -0700 | [diff] [blame] | 581 | } |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 582 | if (hwmonName.empty()) |
| 583 | { |
| 584 | configMap.erase(findSensorCfg); |
| 585 | } |
| 586 | } |
Ed Tanous | 8a17c30 | 2021-09-02 15:07:11 -0700 | [diff] [blame] | 587 | }); |
Zev Weiss | d29f8aa | 2022-08-03 16:24:59 -0700 | [diff] [blame] | 588 | std::vector<std::string> types(sensorTypes.size()); |
| 589 | for (const auto& [type, dt] : sensorTypes) |
| 590 | { |
| 591 | types.push_back(type); |
| 592 | } |
| 593 | getter->getConfiguration(types); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 594 | } |
| 595 | |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 596 | void interfaceRemoved( |
Patrick Williams | 92f8f51 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 597 | sdbusplus::message_t& message, |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 598 | boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>& |
| 599 | sensors) |
| 600 | { |
| 601 | if (message.is_method_error()) |
| 602 | { |
| 603 | std::cerr << "interfacesRemoved callback method error\n"; |
| 604 | return; |
| 605 | } |
| 606 | |
| 607 | sdbusplus::message::object_path path; |
| 608 | std::vector<std::string> interfaces; |
| 609 | |
| 610 | message.read(path, interfaces); |
| 611 | |
| 612 | // If the xyz.openbmc_project.Confguration.X interface was removed |
| 613 | // for one or more sensors, delete those sensor objects. |
| 614 | auto sensorIt = sensors.begin(); |
| 615 | while (sensorIt != sensors.end()) |
| 616 | { |
| 617 | if ((sensorIt->second->configurationPath == path) && |
| 618 | (std::find(interfaces.begin(), interfaces.end(), |
Matt Spinler | 55832f3 | 2023-06-07 10:24:00 -0500 | [diff] [blame] | 619 | sensorIt->second->configInterface) != interfaces.end())) |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 620 | { |
| 621 | sensorIt = sensors.erase(sensorIt); |
| 622 | } |
| 623 | else |
| 624 | { |
| 625 | sensorIt++; |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 630 | static void powerStateChanged( |
| 631 | PowerState type, bool newState, |
| 632 | boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>>& |
| 633 | sensors, |
Ed Tanous | 1f97863 | 2023-02-28 18:16:39 -0800 | [diff] [blame] | 634 | boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer, |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 635 | std::shared_ptr<sdbusplus::asio::connection>& dbusConnection) |
| 636 | { |
| 637 | if (newState) |
| 638 | { |
| 639 | createSensors(io, objectServer, sensors, dbusConnection, nullptr, true); |
| 640 | } |
| 641 | else |
| 642 | { |
| 643 | for (auto& [path, sensor] : sensors) |
| 644 | { |
| 645 | if (sensor != nullptr && sensor->readState == type) |
| 646 | { |
| 647 | sensor->deactivate(); |
| 648 | } |
| 649 | } |
| 650 | } |
| 651 | } |
| 652 | |
James Feist | b6c0b91 | 2019-07-09 12:21:44 -0700 | [diff] [blame] | 653 | int main() |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 654 | { |
Ed Tanous | 1f97863 | 2023-02-28 18:16:39 -0800 | [diff] [blame] | 655 | boost::asio::io_context io; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 656 | auto systemBus = std::make_shared<sdbusplus::asio::connection>(io); |
Ed Tanous | 14ed5e9 | 2022-07-12 15:50:23 -0700 | [diff] [blame] | 657 | sdbusplus::asio::object_server objectServer(systemBus, true); |
| 658 | objectServer.add_manager("/xyz/openbmc_project/sensors"); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 659 | systemBus->request_name("xyz.openbmc_project.HwmonTempSensor"); |
Ed Tanous | 14ed5e9 | 2022-07-12 15:50:23 -0700 | [diff] [blame] | 660 | |
Yong Li | f3fd191 | 2020-03-25 21:35:23 +0800 | [diff] [blame] | 661 | boost::container::flat_map<std::string, std::shared_ptr<HwmonTempSensor>> |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 662 | sensors; |
James Feist | 5591cf08 | 2020-07-15 16:44:54 -0700 | [diff] [blame] | 663 | auto sensorsChanged = |
| 664 | std::make_shared<boost::container::flat_set<std::string>>(); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 665 | |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 666 | auto powerCallBack = [&sensors, &io, &objectServer, |
| 667 | &systemBus](PowerState type, bool state) { |
| 668 | powerStateChanged(type, state, sensors, io, objectServer, systemBus); |
| 669 | }; |
| 670 | setupPowerMatchCallback(systemBus, powerCallBack); |
| 671 | |
Ed Tanous | 83db50c | 2023-03-01 10:20:24 -0800 | [diff] [blame] | 672 | boost::asio::post(io, [&]() { |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 673 | createSensors(io, objectServer, sensors, systemBus, nullptr, false); |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 674 | }); |
| 675 | |
Ed Tanous | 9b4a20e | 2022-09-06 08:47:11 -0700 | [diff] [blame] | 676 | boost::asio::steady_timer filterTimer(io); |
Patrick Williams | 92f8f51 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 677 | std::function<void(sdbusplus::message_t&)> eventHandler = |
| 678 | [&](sdbusplus::message_t& message) { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 679 | if (message.is_method_error()) |
| 680 | { |
| 681 | std::cerr << "callback method error\n"; |
| 682 | return; |
| 683 | } |
| 684 | sensorsChanged->insert(message.get_path()); |
| 685 | // this implicitly cancels the timer |
Ed Tanous | 83db50c | 2023-03-01 10:20:24 -0800 | [diff] [blame] | 686 | filterTimer.expires_after(std::chrono::seconds(1)); |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 687 | |
| 688 | filterTimer.async_wait([&](const boost::system::error_code& ec) { |
| 689 | if (ec == boost::asio::error::operation_aborted) |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 690 | { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 691 | /* we were canceled*/ |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 692 | return; |
| 693 | } |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 694 | if (ec) |
| 695 | { |
| 696 | std::cerr << "timer error\n"; |
| 697 | return; |
| 698 | } |
Zev Weiss | a1456c4 | 2022-07-18 16:59:35 -0700 | [diff] [blame] | 699 | createSensors(io, objectServer, sensors, systemBus, sensorsChanged, |
| 700 | false); |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 701 | }); |
| 702 | }; |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 703 | |
Zev Weiss | 214d971 | 2022-08-12 12:54:31 -0700 | [diff] [blame] | 704 | std::vector<std::unique_ptr<sdbusplus::bus::match_t>> matches = |
| 705 | setupPropertiesChangedMatches(*systemBus, sensorTypes, eventHandler); |
Bruce Lee | 1263c3d | 2021-06-04 15:16:33 +0800 | [diff] [blame] | 706 | setupManufacturingModeMatch(*systemBus); |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 707 | |
| 708 | // Watch for entity-manager to remove configuration interfaces |
| 709 | // so the corresponding sensors can be removed. |
Patrick Williams | 92f8f51 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 710 | auto ifaceRemovedMatch = std::make_unique<sdbusplus::bus::match_t>( |
| 711 | static_cast<sdbusplus::bus_t&>(*systemBus), |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 712 | "type='signal',member='InterfacesRemoved',arg0path='" + |
| 713 | std::string(inventoryPath) + "/'", |
Patrick Williams | 92f8f51 | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 714 | [&sensors](sdbusplus::message_t& msg) { |
Ed Tanous | bb67932 | 2022-05-16 16:10:00 -0700 | [diff] [blame] | 715 | interfaceRemoved(msg, sensors); |
Matt Spinler | 20bf2c1 | 2021-09-14 11:07:07 -0500 | [diff] [blame] | 716 | }); |
| 717 | |
| 718 | matches.emplace_back(std::move(ifaceRemovedMatch)); |
| 719 | |
James Feist | 6714a25 | 2018-09-10 15:26:18 -0700 | [diff] [blame] | 720 | io.run(); |
| 721 | } |