blob: 6354e2c5e854f7e0fbec043d7ba64e2625dfd5ae [file] [log] [blame]
James Feist6ef20402019-01-07 16:45:08 -08001/*
2// Copyright (c) 2019 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 "IpmbSensor.hpp"
18
19#include "Utils.hpp"
20#include "VariantVisitors.hpp"
21
22#include <math.h>
23
24#include <boost/algorithm/string.hpp>
25#include <boost/algorithm/string/predicate.hpp>
26#include <boost/algorithm/string/replace.hpp>
Patrick Venture96e97db2019-10-31 13:44:38 -070027#include <boost/container/flat_map.hpp>
James Feist38fb5982020-05-28 10:09:54 -070028#include <sdbusplus/asio/connection.hpp>
29#include <sdbusplus/asio/object_server.hpp>
30#include <sdbusplus/bus/match.hpp>
31
James Feist6ef20402019-01-07 16:45:08 -080032#include <chrono>
Patrick Venture96e97db2019-10-31 13:44:38 -070033#include <functional>
James Feist6ef20402019-01-07 16:45:08 -080034#include <iostream>
35#include <limits>
Patrick Venture96e97db2019-10-31 13:44:38 -070036#include <memory>
James Feist6ef20402019-01-07 16:45:08 -080037#include <numeric>
Patrick Venture96e97db2019-10-31 13:44:38 -070038#include <string>
39#include <tuple>
40#include <variant>
James Feist6ef20402019-01-07 16:45:08 -080041#include <vector>
42
43constexpr const bool debug = false;
44
45constexpr const char* configInterface =
46 "xyz.openbmc_project.Configuration.IpmbSensor";
47static constexpr double ipmbMaxReading = 0xFF;
48static constexpr double ipmbMinReading = 0;
49
50static constexpr uint8_t meAddress = 1;
51static constexpr uint8_t lun = 0;
52
Vijay Khemka682a5cb2019-07-18 17:34:03 -070053static constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/";
54
James Feist6ef20402019-01-07 16:45:08 -080055using IpmbMethodType =
56 std::tuple<int, uint8_t, uint8_t, uint8_t, uint8_t, std::vector<uint8_t>>;
57
James Feistf7e2c5d2019-02-13 17:27:51 -080058boost::container::flat_map<std::string, std::unique_ptr<IpmbSensor>> sensors;
59
James Feist0d4f2bd2019-03-05 13:15:40 -080060std::unique_ptr<boost::asio::deadline_timer> initCmdTimer;
61
James Feist6ef20402019-01-07 16:45:08 -080062IpmbSensor::IpmbSensor(std::shared_ptr<sdbusplus::asio::connection>& conn,
63 boost::asio::io_service& io,
64 const std::string& sensorName,
65 const std::string& sensorConfiguration,
66 sdbusplus::asio::object_server& objectServer,
67 std::vector<thresholds::Threshold>&& thresholdData,
Vijay Khemka682a5cb2019-07-18 17:34:03 -070068 uint8_t deviceAddress, std::string& sensorTypeName) :
James Feist6ef20402019-01-07 16:45:08 -080069 Sensor(boost::replace_all_copy(sensorName, " ", "_"),
James Feist930fcde2019-05-28 12:58:43 -070070 std::move(thresholdData), sensorConfiguration,
71 "xyz.openbmc_project.Configuration.ExitAirTemp", ipmbMaxReading,
72 ipmbMinReading),
Brad Bishopfbb44ad2019-11-08 09:42:37 -050073 deviceAddress(deviceAddress), readState(PowerState::on),
74 objectServer(objectServer), dbusConnection(conn), waitTimer(io)
James Feist6ef20402019-01-07 16:45:08 -080075{
Vijay Khemka682a5cb2019-07-18 17:34:03 -070076 std::string dbusPath = sensorPathPrefix + sensorTypeName + "/" + name;
77
James Feist6ef20402019-01-07 16:45:08 -080078 sensorInterface = objectServer.add_interface(
Vijay Khemka682a5cb2019-07-18 17:34:03 -070079 dbusPath, "xyz.openbmc_project.Sensor.Value");
James Feist6ef20402019-01-07 16:45:08 -080080
81 if (thresholds::hasWarningInterface(thresholds))
82 {
83 thresholdInterfaceWarning = objectServer.add_interface(
Vijay Khemka682a5cb2019-07-18 17:34:03 -070084 dbusPath, "xyz.openbmc_project.Sensor.Threshold.Warning");
James Feist6ef20402019-01-07 16:45:08 -080085 }
86 if (thresholds::hasCriticalInterface(thresholds))
87 {
88 thresholdInterfaceCritical = objectServer.add_interface(
Vijay Khemka682a5cb2019-07-18 17:34:03 -070089 dbusPath, "xyz.openbmc_project.Sensor.Threshold.Critical");
James Feist6ef20402019-01-07 16:45:08 -080090 }
James Feist2adc95c2019-09-30 14:55:28 -070091 association = objectServer.add_interface(dbusPath, association::interface);
James Feist6ef20402019-01-07 16:45:08 -080092 setupPowerMatch(conn);
93}
94
95IpmbSensor::~IpmbSensor()
96{
97 waitTimer.cancel();
98 objectServer.remove_interface(thresholdInterfaceWarning);
99 objectServer.remove_interface(thresholdInterfaceCritical);
100 objectServer.remove_interface(sensorInterface);
James Feist078f2322019-03-08 11:09:05 -0800101 objectServer.remove_interface(association);
James Feist6ef20402019-01-07 16:45:08 -0800102}
103
104void IpmbSensor::init(void)
105{
James Feist6ef20402019-01-07 16:45:08 -0800106 loadDefaults();
Adrian Ambrożewicz45e92772020-06-04 13:59:55 +0200107 setInitialProperties(dbusConnection);
James Feist6ef20402019-01-07 16:45:08 -0800108 if (initCommand)
109 {
James Feistf7e2c5d2019-02-13 17:27:51 -0800110 runInitCmd();
111 }
112 read();
113}
114
115void IpmbSensor::runInitCmd()
116{
117 if (initCommand)
118 {
James Feist6ef20402019-01-07 16:45:08 -0800119 dbusConnection->async_method_call(
120 [this](boost::system::error_code ec,
121 const IpmbMethodType& response) {
122 const int& status = std::get<0>(response);
123
124 if (ec || status)
125 {
126 std::cerr
127 << "Error setting init command for device: " << name
128 << "\n";
129 }
James Feist6ef20402019-01-07 16:45:08 -0800130 },
131 "xyz.openbmc_project.Ipmi.Channel.Ipmb",
132 "/xyz/openbmc_project/Ipmi/Channel/Ipmb", "org.openbmc.Ipmb",
133 "sendRequest", commandAddress, netfn, lun, *initCommand, initData);
134 }
James Feist6ef20402019-01-07 16:45:08 -0800135}
136
137void IpmbSensor::loadDefaults()
138{
139 if (type == IpmbType::meSensor)
140 {
141 commandAddress = meAddress;
142 netfn = 0x4; // sensor
143 command = 0x2d; // get sensor reading
144 commandData = {deviceAddress};
145 }
146 else if (type == IpmbType::PXE1410CVR)
147 {
148 commandAddress = meAddress;
149 netfn = 0x2e; // me bridge
150 command = 0xd9; // send raw pmbus
151 initCommand = 0xd9; // send raw pmbus
152 commandData = {0x57, 0x01, 0x00, 0x16, 0x03, deviceAddress, 00,
153 0x00, 0x00, 0x00, 0x01, 0x02, 0x29};
154 initData = {0x57, 0x01, 0x00, 0x14, 0x03, deviceAddress, 0x00,
155 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x60};
156 }
157 else if (type == IpmbType::IR38363VR)
158 {
159 commandAddress = meAddress;
160 netfn = 0x2e; // me bridge
161 command = 0xd9; // send raw pmbus
162 commandData = {0x57, 0x01, 0x00, 0x16, 0x03, deviceAddress, 00,
163 0x00, 0x00, 0x00, 0x01, 0x02, 0x8D};
164 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700165 else if (type == IpmbType::ADM1278HSC)
166 {
167 commandAddress = meAddress;
168 switch (subType)
169 {
170 case IpmbSubType::temp:
171 case IpmbSubType::curr:
172 uint8_t snsNum;
173 if (subType == IpmbSubType::temp)
174 snsNum = 0x8d;
175 else
176 snsNum = 0x8c;
177 netfn = 0x2e; // me bridge
178 command = 0xd9; // send raw pmbus
179 commandData = {0x57, 0x01, 0x00, 0x86, deviceAddress,
180 0x00, 0x00, 0x01, 0x02, snsNum};
181 break;
182 case IpmbSubType::power:
183 case IpmbSubType::volt:
184 netfn = 0x4; // sensor
185 command = 0x2d; // get sensor reading
186 commandData = {deviceAddress};
187 break;
188 default:
189 throw std::runtime_error("Invalid sensor type");
190 }
191 }
James Feist6ef20402019-01-07 16:45:08 -0800192 else if (type == IpmbType::mpsVR)
193 {
194 commandAddress = meAddress;
195 netfn = 0x2e; // me bridge
196 command = 0xd9; // send raw pmbus
197 initCommand = 0xd9; // send raw pmbus
198 commandData = {0x57, 0x01, 0x00, 0x16, 0x3, deviceAddress, 0x00,
199 0x00, 0x00, 0x00, 0x01, 0x02, 0x8d};
200 initData = {0x57, 0x01, 0x00, 0x14, 0x03, deviceAddress, 0x00,
201 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00};
202 }
203 else
204 {
205 throw std::runtime_error("Invalid sensor type");
206 }
Adrian Ambrożewicz45e92772020-06-04 13:59:55 +0200207
208 if (subType == IpmbSubType::util)
209 {
210 // Utilization need to be scaled to percent
211 maxValue = 100;
212 minValue = 0;
213 }
James Feist6ef20402019-01-07 16:45:08 -0800214}
215
216void IpmbSensor::checkThresholds(void)
217{
218 if (readState == PowerState::on && !isPowerOn())
219 {
220 return;
221 }
James Feistfc94b212019-02-06 16:14:51 -0800222 else if (readState == PowerState::biosPost && !hasBiosPost())
223 {
224 return;
225 }
James Feist6ef20402019-01-07 16:45:08 -0800226 thresholds::checkThresholds(this);
227}
228
James Feist551087a2019-12-09 11:17:12 -0800229void IpmbSensor::processError(void)
230{
231 static constexpr size_t errorFilter = 2;
232
233 if (!errorCount)
234 {
235 std::cerr << "Invalid data from device: " << name << "\n";
236 }
237 else if (errorCount > errorFilter)
238 {
239 updateValue(0);
240 }
241 if (errorCount < std::numeric_limits<uint8_t>::max())
242 {
243 errorCount++;
244 }
245}
246
James Feist6ef20402019-01-07 16:45:08 -0800247void IpmbSensor::read(void)
248{
249 static constexpr size_t pollTime = 1; // in seconds
250
251 waitTimer.expires_from_now(boost::posix_time::seconds(pollTime));
252 waitTimer.async_wait([this](const boost::system::error_code& ec) {
253 if (ec == boost::asio::error::operation_aborted)
254 {
255 return; // we're being canceled
256 }
James Feist52497fd2019-06-07 13:01:33 -0700257 if (!isPowerOn() && readState != PowerState::always)
James Feist6ef20402019-01-07 16:45:08 -0800258 {
259 updateValue(0);
260 read();
261 return;
262 }
263 dbusConnection->async_method_call(
264 [this](boost::system::error_code ec,
265 const IpmbMethodType& response) {
266 const int& status = std::get<0>(response);
267 if (ec || status)
268 {
James Feist551087a2019-12-09 11:17:12 -0800269 processError();
James Feist6ef20402019-01-07 16:45:08 -0800270 updateValue(0);
271 read();
272 return;
273 }
James Feist52497fd2019-06-07 13:01:33 -0700274 if (!isPowerOn() && readState != PowerState::always)
James Feist6ef20402019-01-07 16:45:08 -0800275 {
276 updateValue(0);
277 read();
278 return;
279 }
280 const std::vector<uint8_t>& data = std::get<5>(response);
281 if constexpr (debug)
282 {
283 std::cout << name << ": ";
284 for (size_t d : data)
285 {
286 std::cout << d << " ";
287 }
288 std::cout << "\n";
289 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700290 double value = 0;
James Feist6ef20402019-01-07 16:45:08 -0800291 if (type == IpmbType::meSensor)
292 {
293 if (data.empty())
294 {
James Feist551087a2019-12-09 11:17:12 -0800295 processError();
James Feist6ef20402019-01-07 16:45:08 -0800296 read();
297 return;
298 }
299 value = data[0];
300 }
301 else if (type == IpmbType::PXE1410CVR ||
302 type == IpmbType::IR38363VR)
303 {
Patrick Venture61bc6dc2019-10-10 09:17:04 -0700304 if (data.size() < 5)
James Feist6ef20402019-01-07 16:45:08 -0800305 {
James Feist551087a2019-12-09 11:17:12 -0800306 processError();
James Feist6ef20402019-01-07 16:45:08 -0800307 read();
308 return;
309 }
310 // format based on the 11 bit linear data format
311 value = ((data[4] << 8) | data[3]) >> 3;
312 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700313 else if (type == IpmbType::ADM1278HSC)
314 {
315 if (data.empty())
316 {
James Feist551087a2019-12-09 11:17:12 -0800317 processError();
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700318 read();
319 return;
320 }
321 switch (subType)
322 {
323 case IpmbSubType::temp:
324 case IpmbSubType::curr:
325 // format based on the 11 bit linear data format
326 value = ((data[4] << 8) | data[3]);
327 break;
328 case IpmbSubType::power:
329 case IpmbSubType::volt:
Adrian Ambrożewicz45e92772020-06-04 13:59:55 +0200330 case IpmbSubType::util:
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700331 value = data[0];
332 break;
333 }
334 }
James Feist6ef20402019-01-07 16:45:08 -0800335 else if (type == IpmbType::mpsVR)
336 {
337 if (data.size() < 4)
338 {
James Feist551087a2019-12-09 11:17:12 -0800339 processError();
James Feist6ef20402019-01-07 16:45:08 -0800340 read();
341 return;
342 }
343 value = data[3];
344 }
345 else
346 {
347 throw std::runtime_error("Invalid sensor type");
348 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700349
350 /* Adjust value as per scale and offset */
351 value = (value * scaleVal) + offsetVal;
James Feist6ef20402019-01-07 16:45:08 -0800352 updateValue(value);
353 read();
James Feist551087a2019-12-09 11:17:12 -0800354 errorCount = 0; // success
James Feist6ef20402019-01-07 16:45:08 -0800355 },
356 "xyz.openbmc_project.Ipmi.Channel.Ipmb",
357 "/xyz/openbmc_project/Ipmi/Channel/Ipmb", "org.openbmc.Ipmb",
358 "sendRequest", commandAddress, netfn, lun, command, commandData);
359 });
360}
361void createSensors(
362 boost::asio::io_service& io, sdbusplus::asio::object_server& objectServer,
363 boost::container::flat_map<std::string, std::unique_ptr<IpmbSensor>>&
364 sensors,
365 std::shared_ptr<sdbusplus::asio::connection>& dbusConnection)
366{
367 if (!dbusConnection)
368 {
369 std::cerr << "Connection not created\n";
370 return;
371 }
372 dbusConnection->async_method_call(
373 [&](boost::system::error_code ec, const ManagedObjectType& resp) {
374 if (ec)
375 {
376 std::cerr << "Error contacting entity manager\n";
377 return;
378 }
379 for (const auto& pathPair : resp)
380 {
381 for (const auto& entry : pathPair.second)
382 {
383 if (entry.first != configInterface)
384 {
385 continue;
386 }
387 std::string name =
388 loadVariant<std::string>(entry.second, "Name");
389
390 std::vector<thresholds::Threshold> sensorThresholds;
391 if (!parseThresholdsFromConfig(pathPair.second,
392 sensorThresholds))
393 {
394 std::cerr << "error populating thresholds for " << name
395 << "\n";
396 }
397 uint8_t deviceAddress =
398 loadVariant<uint8_t>(entry.second, "Address");
399
400 std::string sensorClass =
401 loadVariant<std::string>(entry.second, "Class");
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700402
403 /* Default sensor type is "temperature" */
404 std::string sensorTypeName = "temperature";
405 auto findType = entry.second.find("SensorType");
406 if (findType != entry.second.end())
407 {
408 sensorTypeName = std::visit(VariantToStringVisitor(),
409 findType->second);
410 }
411
James Feist6ef20402019-01-07 16:45:08 -0800412 auto& sensor = sensors[name];
413 sensor = std::make_unique<IpmbSensor>(
414 dbusConnection, io, name, pathPair.first, objectServer,
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700415 std::move(sensorThresholds), deviceAddress,
416 sensorTypeName);
417
418 /* Initialize scale and offset value */
419 sensor->scaleVal = 1;
420 sensor->offsetVal = 0;
421
422 auto findScaleVal = entry.second.find("ScaleValue");
423 if (findScaleVal != entry.second.end())
424 {
425 sensor->scaleVal = std::visit(VariantToDoubleVisitor(),
426 findScaleVal->second);
427 }
428
429 auto findOffsetVal = entry.second.find("OffsetValue");
430 if (findOffsetVal != entry.second.end())
431 {
432 sensor->offsetVal = std::visit(VariantToDoubleVisitor(),
433 findOffsetVal->second);
434 }
James Feist6ef20402019-01-07 16:45:08 -0800435
James Feistfc94b212019-02-06 16:14:51 -0800436 auto findPowerState = entry.second.find("PowerState");
437
438 if (findPowerState != entry.second.end())
439 {
440 std::string powerState = std::visit(
441 VariantToStringVisitor(), findPowerState->second);
442
443 setReadState(powerState, sensor->readState);
444 }
445
James Feist6ef20402019-01-07 16:45:08 -0800446 if (sensorClass == "PxeBridgeTemp")
447 {
448 sensor->type = IpmbType::PXE1410CVR;
449 }
450 else if (sensorClass == "IRBridgeTemp")
451 {
452 sensor->type = IpmbType::IR38363VR;
453 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700454 else if (sensorClass == "HSCBridge")
455 {
456 sensor->type = IpmbType::ADM1278HSC;
457 }
James Feist6ef20402019-01-07 16:45:08 -0800458 else if (sensorClass == "MpsBridgeTemp")
459 {
460 sensor->type = IpmbType::mpsVR;
461 }
Adrian Ambrożewicz45e92772020-06-04 13:59:55 +0200462 else if (sensorClass == "METemp" ||
463 sensorClass == "MESensor")
James Feist6ef20402019-01-07 16:45:08 -0800464 {
465 sensor->type = IpmbType::meSensor;
466 }
467 else
468 {
469 std::cerr << "Invalid class " << sensorClass << "\n";
470 continue;
471 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700472
473 if (sensorTypeName == "voltage")
474 {
475 sensor->subType = IpmbSubType::volt;
476 }
477 else if (sensorTypeName == "power")
478 {
479 sensor->subType = IpmbSubType::power;
480 }
481 else if (sensorTypeName == "current")
482 {
483 sensor->subType = IpmbSubType::curr;
484 }
Adrian Ambrożewicz45e92772020-06-04 13:59:55 +0200485 else if (sensorTypeName == "utilization")
486 {
487 sensor->subType = IpmbSubType::util;
488 }
Vijay Khemka682a5cb2019-07-18 17:34:03 -0700489 else
490 {
491 sensor->subType = IpmbSubType::temp;
492 }
James Feist6ef20402019-01-07 16:45:08 -0800493 sensor->init();
494 }
495 }
496 },
497 entityManagerName, "/", "org.freedesktop.DBus.ObjectManager",
498 "GetManagedObjects");
499}
500
James Feistf7e2c5d2019-02-13 17:27:51 -0800501void reinitSensors(sdbusplus::message::message& message)
502{
James Feist0d4f2bd2019-03-05 13:15:40 -0800503 constexpr const size_t reinitWaitSeconds = 2;
James Feistf7e2c5d2019-02-13 17:27:51 -0800504 std::string objectName;
James Feist52497fd2019-06-07 13:01:33 -0700505 boost::container::flat_map<std::string, std::variant<std::string>> values;
James Feistf7e2c5d2019-02-13 17:27:51 -0800506 message.read(objectName, values);
James Feist0d4f2bd2019-03-05 13:15:40 -0800507
James Feist52497fd2019-06-07 13:01:33 -0700508 auto findStatus = values.find(power::property);
509 if (findStatus != values.end())
James Feistf7e2c5d2019-02-13 17:27:51 -0800510 {
James Feist52497fd2019-06-07 13:01:33 -0700511 bool powerStatus = boost::ends_with(
512 std::get<std::string>(findStatus->second), "Running");
James Feistf7e2c5d2019-02-13 17:27:51 -0800513 if (powerStatus)
514 {
James Feist0d4f2bd2019-03-05 13:15:40 -0800515 if (!initCmdTimer)
James Feistf7e2c5d2019-02-13 17:27:51 -0800516 {
James Feist0d4f2bd2019-03-05 13:15:40 -0800517 // this should be impossible
518 return;
James Feistf7e2c5d2019-02-13 17:27:51 -0800519 }
James Feist0d4f2bd2019-03-05 13:15:40 -0800520 // we seem to send this command too fast sometimes, wait before
521 // sending
522 initCmdTimer->expires_from_now(
523 boost::posix_time::seconds(reinitWaitSeconds));
524
525 initCmdTimer->async_wait([](const boost::system::error_code ec) {
526 if (ec == boost::asio::error::operation_aborted)
527 {
528 return; // we're being canceled
529 }
530
531 for (const auto& sensor : sensors)
532 {
533 if (sensor.second)
534 {
535 sensor.second->runInitCmd();
536 }
537 }
538 });
James Feistf7e2c5d2019-02-13 17:27:51 -0800539 }
540 }
541}
542
James Feistb6c0b912019-07-09 12:21:44 -0700543int main()
James Feist6ef20402019-01-07 16:45:08 -0800544{
545
546 boost::asio::io_service io;
547 auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
548 systemBus->request_name("xyz.openbmc_project.IpmbSensor");
549 sdbusplus::asio::object_server objectServer(systemBus);
James Feist6ef20402019-01-07 16:45:08 -0800550
James Feist0d4f2bd2019-03-05 13:15:40 -0800551 initCmdTimer = std::make_unique<boost::asio::deadline_timer>(io);
552
James Feist6ef20402019-01-07 16:45:08 -0800553 io.post([&]() { createSensors(io, objectServer, sensors, systemBus); });
554
555 boost::asio::deadline_timer configTimer(io);
556
557 std::function<void(sdbusplus::message::message&)> eventHandler =
James Feistb6c0b912019-07-09 12:21:44 -0700558 [&](sdbusplus::message::message&) {
James Feist6ef20402019-01-07 16:45:08 -0800559 configTimer.expires_from_now(boost::posix_time::seconds(1));
560 // create a timer because normally multiple properties change
561 configTimer.async_wait([&](const boost::system::error_code& ec) {
562 if (ec == boost::asio::error::operation_aborted)
563 {
564 return; // we're being canceled
565 }
566 createSensors(io, objectServer, sensors, systemBus);
567 if (sensors.empty())
568 {
569 std::cout << "Configuration not detected\n";
570 }
571 });
572 };
573
James Feistf7e2c5d2019-02-13 17:27:51 -0800574 sdbusplus::bus::match::match configMatch(
James Feist6ef20402019-01-07 16:45:08 -0800575 static_cast<sdbusplus::bus::bus&>(*systemBus),
576 "type='signal',member='PropertiesChanged',path_namespace='" +
577 std::string(inventoryPath) + "',arg0namespace='" + configInterface +
578 "'",
579 eventHandler);
580
James Feistf7e2c5d2019-02-13 17:27:51 -0800581 sdbusplus::bus::match::match powerChangeMatch(
582 static_cast<sdbusplus::bus::bus&>(*systemBus),
James Feist52497fd2019-06-07 13:01:33 -0700583 "type='signal',interface='" + std::string(properties::interface) +
584 "',path='" + std::string(power::path) + "',arg0='" +
585 std::string(power::interface) + "'",
James Feistf7e2c5d2019-02-13 17:27:51 -0800586 reinitSensors);
587
James Feist6ef20402019-01-07 16:45:08 -0800588 io.run();
589}