blob: f69f54d341d2e6cc33bc2aea6a70ac9072921b1a [file] [log] [blame]
James Feist7136a5a2018-07-19 09:52:05 -07001/*
2// Copyright (c) 2018 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
Patrick Venture07716592018-10-14 11:46:40 -070017#include "conf.hpp"
Patrick Ventureef1f8862020-08-17 09:34:35 -070018#include "dbushelper.hpp"
19#include "dbusutil.hpp"
James Feist0c8223b2019-05-08 15:33:33 -070020#include "util.hpp"
Patrick Venture07716592018-10-14 11:46:40 -070021
James Feist1fe08952019-05-07 09:17:16 -070022#include <boost/asio/steady_timer.hpp>
Patrick Venturea83a3ec2020-08-04 09:52:05 -070023#include <sdbusplus/bus.hpp>
24#include <sdbusplus/bus/match.hpp>
25#include <sdbusplus/exception.hpp>
26
27#include <algorithm>
James Feist64f072a2018-08-10 16:39:24 -070028#include <chrono>
James Feist64f072a2018-08-10 16:39:24 -070029#include <functional>
James Feist7136a5a2018-07-19 09:52:05 -070030#include <iostream>
James Feist1fe08952019-05-07 09:17:16 -070031#include <list>
James Feist1738e2a2019-02-04 15:57:03 -080032#include <regex>
James Feist7136a5a2018-07-19 09:52:05 -070033#include <set>
34#include <unordered_map>
James Feist1f802f52019-02-08 13:51:43 -080035#include <variant>
James Feist7136a5a2018-07-19 09:52:05 -070036
Patrick Venturea0764872020-08-08 07:48:43 -070037namespace pid_control
38{
39
James Feist7136a5a2018-07-19 09:52:05 -070040static constexpr bool DEBUG = false; // enable to print found configuration
41
James Feistf81f2882019-02-26 11:26:36 -080042extern std::map<std::string, struct conf::SensorConfig> sensorConfig;
43extern std::map<int64_t, conf::PIDConf> zoneConfig;
44extern std::map<int64_t, struct conf::ZoneConfig> zoneDetailsConfig;
James Feist7136a5a2018-07-19 09:52:05 -070045
Patrick Venturee2ec0f62018-09-04 12:30:27 -070046constexpr const char* pidConfigurationInterface =
James Feist7136a5a2018-07-19 09:52:05 -070047 "xyz.openbmc_project.Configuration.Pid";
Patrick Venturee2ec0f62018-09-04 12:30:27 -070048constexpr const char* objectManagerInterface =
James Feist7136a5a2018-07-19 09:52:05 -070049 "org.freedesktop.DBus.ObjectManager";
Patrick Venturee2ec0f62018-09-04 12:30:27 -070050constexpr const char* pidZoneConfigurationInterface =
James Feist7136a5a2018-07-19 09:52:05 -070051 "xyz.openbmc_project.Configuration.Pid.Zone";
James Feist22c257a2018-08-31 14:07:12 -070052constexpr const char* stepwiseConfigurationInterface =
53 "xyz.openbmc_project.Configuration.Stepwise";
James Feistf0096a02019-02-21 11:25:22 -080054constexpr const char* thermalControlIface =
55 "xyz.openbmc_project.Control.ThermalMode";
Patrick Venturee2ec0f62018-09-04 12:30:27 -070056constexpr const char* sensorInterface = "xyz.openbmc_project.Sensor.Value";
Patrick Venture0911bfe2020-08-10 12:51:40 -070057constexpr const char* defaultPwmInterface =
58 "xyz.openbmc_project.Control.FanPwm";
James Feist7136a5a2018-07-19 09:52:05 -070059
James Feist991ebd82020-07-21 11:14:52 -070060using Association = std::tuple<std::string, std::string, std::string>;
61using Associations = std::vector<Association>;
62
James Feist5ec20272019-07-10 11:59:57 -070063namespace thresholds
64{
65constexpr const char* warningInterface =
66 "xyz.openbmc_project.Sensor.Threshold.Warning";
67constexpr const char* criticalInterface =
68 "xyz.openbmc_project.Sensor.Threshold.Critical";
69const std::array<const char*, 4> types = {"CriticalLow", "CriticalHigh",
70 "WarningLow", "WarningHigh"};
71
72} // namespace thresholds
73
James Feist7136a5a2018-07-19 09:52:05 -070074namespace dbus_configuration
75{
James Feist5ec20272019-07-10 11:59:57 -070076using DbusVariantType =
77 std::variant<uint64_t, int64_t, double, std::string,
78 std::vector<std::string>, std::vector<double>>;
Jason Lingf3b04fd2020-07-24 09:33:04 -070079using SensorInterfaceType = std::pair<std::string, std::string>;
80
81inline std::string getSensorNameFromPath(const std::string& dbusPath)
82{
83 return dbusPath.substr(dbusPath.find_last_of("/") + 1);
84}
85
86inline std::string sensorNameToDbusName(const std::string& sensorName)
87{
88 std::string retString = sensorName;
89 std::replace(retString.begin(), retString.end(), ' ', '_');
90 return retString;
91}
James Feist5ec20272019-07-10 11:59:57 -070092
James Feist1738e2a2019-02-04 15:57:03 -080093bool findSensors(const std::unordered_map<std::string, std::string>& sensors,
94 const std::string& search,
95 std::vector<std::pair<std::string, std::string>>& matches)
James Feist7136a5a2018-07-19 09:52:05 -070096{
James Feist1738e2a2019-02-04 15:57:03 -080097 std::smatch match;
Jae Hyun Yoo1a704dc2020-06-04 15:00:10 -070098 std::regex reg(search + '$');
James Feist1738e2a2019-02-04 15:57:03 -080099 for (const auto& sensor : sensors)
James Feist7136a5a2018-07-19 09:52:05 -0700100 {
James Feist1738e2a2019-02-04 15:57:03 -0800101 if (std::regex_search(sensor.first, match, reg))
102 {
103 matches.push_back(sensor);
104 }
James Feist7136a5a2018-07-19 09:52:05 -0700105 }
James Feist1738e2a2019-02-04 15:57:03 -0800106 return matches.size() > 0;
James Feist7136a5a2018-07-19 09:52:05 -0700107}
108
109// this function prints the configuration into a form similar to the cpp
110// generated code to help in verification, should be turned off during normal
111// use
112void debugPrint(void)
113{
114 // print sensor config
115 std::cout << "sensor config:\n";
116 std::cout << "{\n";
Patrick Venturec54fbd82018-10-30 19:40:05 -0700117 for (const auto& pair : sensorConfig)
James Feist7136a5a2018-07-19 09:52:05 -0700118 {
119
120 std::cout << "\t{" << pair.first << ",\n\t\t{";
121 std::cout << pair.second.type << ", ";
Patrick Venture69c51062019-02-11 09:46:03 -0800122 std::cout << pair.second.readPath << ", ";
123 std::cout << pair.second.writePath << ", ";
James Feist7136a5a2018-07-19 09:52:05 -0700124 std::cout << pair.second.min << ", ";
125 std::cout << pair.second.max << ", ";
126 std::cout << pair.second.timeout << "},\n\t},\n";
127 }
128 std::cout << "}\n\n";
129 std::cout << "ZoneDetailsConfig\n";
130 std::cout << "{\n";
Patrick Venturec54fbd82018-10-30 19:40:05 -0700131 for (const auto& zone : zoneDetailsConfig)
James Feist7136a5a2018-07-19 09:52:05 -0700132 {
133 std::cout << "\t{" << zone.first << ",\n";
James Feist3484bed2019-02-25 13:28:18 -0800134 std::cout << "\t\t{" << zone.second.minThermalOutput << ", ";
Patrick Venture8e2fdb32019-02-11 09:39:59 -0800135 std::cout << zone.second.failsafePercent << "}\n\t},\n";
James Feist7136a5a2018-07-19 09:52:05 -0700136 }
137 std::cout << "}\n\n";
138 std::cout << "ZoneConfig\n";
139 std::cout << "{\n";
Patrick Venturec54fbd82018-10-30 19:40:05 -0700140 for (const auto& zone : zoneConfig)
James Feist7136a5a2018-07-19 09:52:05 -0700141 {
142 std::cout << "\t{" << zone.first << "\n";
Patrick Venture4a2dc4d2018-10-23 09:02:55 -0700143 for (const auto& pidconf : zone.second)
James Feist7136a5a2018-07-19 09:52:05 -0700144 {
145 std::cout << "\t\t{" << pidconf.first << ",\n";
146 std::cout << "\t\t\t{" << pidconf.second.type << ",\n";
147 std::cout << "\t\t\t{";
Patrick Venture4a2dc4d2018-10-23 09:02:55 -0700148 for (const auto& input : pidconf.second.inputs)
James Feist7136a5a2018-07-19 09:52:05 -0700149 {
150 std::cout << "\n\t\t\t" << input << ",\n";
151 }
152 std::cout << "\t\t\t}\n";
153 std::cout << "\t\t\t" << pidconf.second.setpoint << ",\n";
James Feist22c257a2018-08-31 14:07:12 -0700154 std::cout << "\t\t\t{" << pidconf.second.pidInfo.ts << ",\n";
Patrick Venture7442c372019-02-11 10:21:05 -0800155 std::cout << "\t\t\t" << pidconf.second.pidInfo.proportionalCoeff
156 << ",\n";
157 std::cout << "\t\t\t" << pidconf.second.pidInfo.integralCoeff
158 << ",\n";
159 std::cout << "\t\t\t" << pidconf.second.pidInfo.feedFwdOffset
160 << ",\n";
161 std::cout << "\t\t\t" << pidconf.second.pidInfo.feedFwdGain
162 << ",\n";
163 std::cout << "\t\t\t{" << pidconf.second.pidInfo.integralLimit.min
164 << "," << pidconf.second.pidInfo.integralLimit.max
165 << "},\n";
166 std::cout << "\t\t\t{" << pidconf.second.pidInfo.outLim.min << ","
167 << pidconf.second.pidInfo.outLim.max << "},\n";
168 std::cout << "\t\t\t" << pidconf.second.pidInfo.slewNeg << ",\n";
169 std::cout << "\t\t\t" << pidconf.second.pidInfo.slewPos << ",\n";
James Feist7136a5a2018-07-19 09:52:05 -0700170 std::cout << "\t\t\t}\n\t\t}\n";
171 }
172 std::cout << "\t},\n";
173 }
174 std::cout << "}\n\n";
175}
176
James Feistffd418b2018-11-15 14:46:36 -0800177size_t getZoneIndex(const std::string& name, std::vector<std::string>& zones)
178{
179 auto it = std::find(zones.begin(), zones.end(), name);
180 if (it == zones.end())
181 {
182 zones.emplace_back(name);
183 it = zones.end() - 1;
184 }
185
186 return it - zones.begin();
187}
188
James Feistf0096a02019-02-21 11:25:22 -0800189std::vector<std::string> getSelectedProfiles(sdbusplus::bus::bus& bus)
190{
191 std::vector<std::string> ret;
192 auto mapper =
193 bus.new_method_call("xyz.openbmc_project.ObjectMapper",
194 "/xyz/openbmc_project/object_mapper",
195 "xyz.openbmc_project.ObjectMapper", "GetSubTree");
196 mapper.append("/", 0, std::array<const char*, 1>{thermalControlIface});
197 std::unordered_map<
198 std::string, std::unordered_map<std::string, std::vector<std::string>>>
199 respData;
200
201 try
202 {
203 auto resp = bus.call(mapper);
204 resp.read(respData);
205 }
206 catch (sdbusplus::exception_t&)
207 {
208 // can't do anything without mapper call data
209 throw std::runtime_error("ObjectMapper Call Failure");
210 }
211 if (respData.empty())
212 {
213 // if the user has profiles but doesn't expose the interface to select
214 // one, just go ahead without using profiles
215 return ret;
216 }
217
218 // assumption is that we should only have a small handful of selected
219 // profiles at a time (probably only 1), so calling each individually should
220 // not incur a large cost
221 for (const auto& objectPair : respData)
222 {
223 const std::string& path = objectPair.first;
224 for (const auto& ownerPair : objectPair.second)
225 {
226 const std::string& busName = ownerPair.first;
227 auto getProfile =
228 bus.new_method_call(busName.c_str(), path.c_str(),
229 "org.freedesktop.DBus.Properties", "Get");
230 getProfile.append(thermalControlIface, "Current");
231 std::variant<std::string> variantResp;
232 try
233 {
234 auto resp = bus.call(getProfile);
235 resp.read(variantResp);
236 }
237 catch (sdbusplus::exception_t&)
238 {
239 throw std::runtime_error("Failure getting profile");
240 }
241 std::string mode = std::get<std::string>(variantResp);
242 ret.emplace_back(std::move(mode));
243 }
244 }
245 if constexpr (DEBUG)
246 {
247 std::cout << "Profiles selected: ";
248 for (const auto& profile : ret)
249 {
250 std::cout << profile << " ";
251 }
252 std::cout << "\n";
253 }
254 return ret;
255}
256
James Feist991ebd82020-07-21 11:14:52 -0700257int eventHandler(sd_bus_message* m, void* context, sd_bus_error*)
James Feist7136a5a2018-07-19 09:52:05 -0700258{
James Feist1fe08952019-05-07 09:17:16 -0700259
James Feist991ebd82020-07-21 11:14:52 -0700260 if (context == nullptr || m == nullptr)
James Feist1fe08952019-05-07 09:17:16 -0700261 {
262 throw std::runtime_error("Invalid match");
263 }
James Feist991ebd82020-07-21 11:14:52 -0700264
265 // we skip associations because the mapper populates these, not the sensors
266 const std::array<const char*, 1> skipList = {
267 "xyz.openbmc_project.Association"};
268
269 sdbusplus::message::message message(m);
270 if (std::string(message.get_member()) == "InterfacesAdded")
271 {
272 sdbusplus::message::object_path path;
273 std::unordered_map<
274 std::string,
275 std::unordered_map<std::string, std::variant<Associations, bool>>>
276 data;
277
278 message.read(path, data);
279
280 for (const char* skip : skipList)
281 {
282 auto find = data.find(skip);
283 if (find != data.end())
284 {
285 data.erase(find);
286 if (data.empty())
287 {
288 return 1;
289 }
290 }
291 }
292 }
293
James Feist1fe08952019-05-07 09:17:16 -0700294 boost::asio::steady_timer* timer =
295 static_cast<boost::asio::steady_timer*>(context);
296
297 // do a brief sleep as we tend to get a bunch of these events at
298 // once
299 timer->expires_after(std::chrono::seconds(2));
300 timer->async_wait([](const boost::system::error_code ec) {
301 if (ec == boost::asio::error::operation_aborted)
302 {
303 /* another timer started*/
304 return;
305 }
306
307 std::cout << "New configuration detected, reloading\n.";
Yong Li298a95c2020-04-07 15:11:02 +0800308 tryRestartControlLoops();
James Feist1fe08952019-05-07 09:17:16 -0700309 });
310
311 return 1;
312}
313
314void createMatches(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
315{
316 // this is a list because the matches can't be moved
317 static std::list<sdbusplus::bus::match::match> matches;
318
James Feist3987c8b2019-05-13 10:43:17 -0700319 const std::array<std::string, 4> interfaces = {
320 thermalControlIface, pidConfigurationInterface,
321 pidZoneConfigurationInterface, stepwiseConfigurationInterface};
James Feist1fe08952019-05-07 09:17:16 -0700322
323 // this list only needs to be created once
324 if (!matches.empty())
325 {
326 return;
327 }
328
329 // we restart when the configuration changes or there are new sensors
330 for (const auto& interface : interfaces)
331 {
332 matches.emplace_back(
333 bus,
334 "type='signal',member='PropertiesChanged',arg0namespace='" +
335 interface + "'",
336 eventHandler, &timer);
337 }
338 matches.emplace_back(
339 bus,
340 "type='signal',member='InterfacesAdded',arg0path='/xyz/openbmc_project/"
341 "sensors/'",
342 eventHandler, &timer);
343}
344
Jason Ling6fc301f2020-07-23 12:39:57 -0700345/**
346 * retrieve an attribute from the pid configuration map
347 * @param[in] base - the PID configuration map, keys are the attributes and
348 * value is the variant associated with that attribute.
349 * @param attributeName - the name of the attribute
350 * @return a variant holding the value associated with a key
351 * @throw runtime_error : attributeName is not in base
352 */
353inline DbusVariantType getPIDAttribute(
354 const std::unordered_map<std::string, DbusVariantType>& base,
355 const std::string& attributeName)
356{
357 auto search = base.find(attributeName);
358 if (search == base.end())
359 {
360 throw std::runtime_error("missing attribute " + attributeName);
361 }
362 return search->second;
363}
364
James Feist5ec20272019-07-10 11:59:57 -0700365void populatePidInfo(
366 sdbusplus::bus::bus& bus,
367 const std::unordered_map<std::string, DbusVariantType>& base,
368 struct conf::ControllerInfo& info, const std::string* thresholdProperty)
369{
Jason Ling6fc301f2020-07-23 12:39:57 -0700370 info.type = std::get<std::string>(getPIDAttribute(base, "Class"));
James Feist5ec20272019-07-10 11:59:57 -0700371 if (info.type == "fan")
372 {
373 info.setpoint = 0;
374 }
375 else
376 {
Jason Ling6fc301f2020-07-23 12:39:57 -0700377 info.setpoint = std::visit(VariantToDoubleVisitor(),
378 getPIDAttribute(base, "SetPoint"));
James Feist5ec20272019-07-10 11:59:57 -0700379 }
380
381 if (thresholdProperty != nullptr)
382 {
383 std::string interface;
384 if (*thresholdProperty == "WarningHigh" ||
385 *thresholdProperty == "WarningLow")
386 {
387 interface = thresholds::warningInterface;
388 }
389 else
390 {
391 interface = thresholds::criticalInterface;
392 }
393 const std::string& path = sensorConfig[info.inputs.front()].readPath;
394
Patrick Venture8729eb92020-08-10 10:38:44 -0700395 DbusHelper helper(sdbusplus::bus::new_system());
Patrick Venture9b936922020-08-10 11:28:39 -0700396 std::string service = helper.getService(interface, path);
James Feist5ec20272019-07-10 11:59:57 -0700397 double reading = 0;
398 try
399 {
Patrick Venture9b936922020-08-10 11:28:39 -0700400 helper.getProperty(service, path, interface, *thresholdProperty,
401 reading);
James Feist5ec20272019-07-10 11:59:57 -0700402 }
403 catch (const sdbusplus::exception::SdBusError& ex)
404 {
405 // unsupported threshold, leaving reading at 0
406 }
407
408 info.setpoint += reading;
409 }
410
411 info.pidInfo.ts = 1.0; // currently unused
Jason Ling6fc301f2020-07-23 12:39:57 -0700412 info.pidInfo.proportionalCoeff = std::visit(
413 VariantToDoubleVisitor(), getPIDAttribute(base, "PCoefficient"));
414 info.pidInfo.integralCoeff = std::visit(
415 VariantToDoubleVisitor(), getPIDAttribute(base, "ICoefficient"));
416 info.pidInfo.feedFwdOffset = std::visit(
417 VariantToDoubleVisitor(), getPIDAttribute(base, "FFOffCoefficient"));
418 info.pidInfo.feedFwdGain = std::visit(
419 VariantToDoubleVisitor(), getPIDAttribute(base, "FFGainCoefficient"));
420 info.pidInfo.integralLimit.max = std::visit(
421 VariantToDoubleVisitor(), getPIDAttribute(base, "ILimitMax"));
422 info.pidInfo.integralLimit.min = std::visit(
423 VariantToDoubleVisitor(), getPIDAttribute(base, "ILimitMin"));
424 info.pidInfo.outLim.max = std::visit(VariantToDoubleVisitor(),
425 getPIDAttribute(base, "OutLimitMax"));
426 info.pidInfo.outLim.min = std::visit(VariantToDoubleVisitor(),
427 getPIDAttribute(base, "OutLimitMin"));
James Feist5ec20272019-07-10 11:59:57 -0700428 info.pidInfo.slewNeg =
Jason Ling6fc301f2020-07-23 12:39:57 -0700429 std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewNeg"));
James Feist5ec20272019-07-10 11:59:57 -0700430 info.pidInfo.slewPos =
Jason Ling6fc301f2020-07-23 12:39:57 -0700431 std::visit(VariantToDoubleVisitor(), getPIDAttribute(base, "SlewPos"));
James Feist5ec20272019-07-10 11:59:57 -0700432 double negativeHysteresis = 0;
433 double positiveHysteresis = 0;
434
435 auto findNeg = base.find("NegativeHysteresis");
436 auto findPos = base.find("PositiveHysteresis");
437
438 if (findNeg != base.end())
439 {
440 negativeHysteresis =
441 std::visit(VariantToDoubleVisitor(), findNeg->second);
442 }
443
444 if (findPos != base.end())
445 {
446 positiveHysteresis =
447 std::visit(VariantToDoubleVisitor(), findPos->second);
448 }
James Feist5ec20272019-07-10 11:59:57 -0700449 info.pidInfo.negativeHysteresis = negativeHysteresis;
450 info.pidInfo.positiveHysteresis = positiveHysteresis;
451}
452
James Feist1fe08952019-05-07 09:17:16 -0700453bool init(sdbusplus::bus::bus& bus, boost::asio::steady_timer& timer)
454{
455
456 sensorConfig.clear();
457 zoneConfig.clear();
458 zoneDetailsConfig.clear();
459
460 createMatches(bus, timer);
461
James Feist22c257a2018-08-31 14:07:12 -0700462 using DbusVariantType =
James Feist1f802f52019-02-08 13:51:43 -0800463 std::variant<uint64_t, int64_t, double, std::string,
464 std::vector<std::string>, std::vector<double>>;
James Feist22c257a2018-08-31 14:07:12 -0700465
James Feist7136a5a2018-07-19 09:52:05 -0700466 using ManagedObjectType = std::unordered_map<
467 sdbusplus::message::object_path,
James Feist22c257a2018-08-31 14:07:12 -0700468 std::unordered_map<std::string,
469 std::unordered_map<std::string, DbusVariantType>>>;
James Feist64f072a2018-08-10 16:39:24 -0700470
James Feist7136a5a2018-07-19 09:52:05 -0700471 auto mapper =
472 bus.new_method_call("xyz.openbmc_project.ObjectMapper",
473 "/xyz/openbmc_project/object_mapper",
474 "xyz.openbmc_project.ObjectMapper", "GetSubTree");
James Feist26e8c6a2018-10-25 10:38:26 -0700475 mapper.append("/", 0,
Patrick Venture0911bfe2020-08-10 12:51:40 -0700476 std::array<const char*, 6>{
477 objectManagerInterface, pidConfigurationInterface,
478 pidZoneConfigurationInterface,
479 stepwiseConfigurationInterface, sensorInterface,
480 defaultPwmInterface});
James Feist7136a5a2018-07-19 09:52:05 -0700481 std::unordered_map<
482 std::string, std::unordered_map<std::string, std::vector<std::string>>>
483 respData;
James Feist22c257a2018-08-31 14:07:12 -0700484 try
485 {
486 auto resp = bus.call(mapper);
James Feist22c257a2018-08-31 14:07:12 -0700487 resp.read(respData);
488 }
489 catch (sdbusplus::exception_t&)
490 {
491 // can't do anything without mapper call data
492 throw std::runtime_error("ObjectMapper Call Failure");
493 }
James Feist7136a5a2018-07-19 09:52:05 -0700494
James Feist7136a5a2018-07-19 09:52:05 -0700495 if (respData.empty())
496 {
James Feist22c257a2018-08-31 14:07:12 -0700497 // can't do anything without mapper call data
James Feist7136a5a2018-07-19 09:52:05 -0700498 throw std::runtime_error("No configuration data available from Mapper");
499 }
500 // create a map of pair of <has pid configuration, ObjectManager path>
501 std::unordered_map<std::string, std::pair<bool, std::string>> owners;
502 // and a map of <path, interface> for sensors
503 std::unordered_map<std::string, std::string> sensors;
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700504 for (const auto& objectPair : respData)
James Feist7136a5a2018-07-19 09:52:05 -0700505 {
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700506 for (const auto& ownerPair : objectPair.second)
James Feist7136a5a2018-07-19 09:52:05 -0700507 {
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700508 auto& owner = owners[ownerPair.first];
509 for (const std::string& interface : ownerPair.second)
James Feist7136a5a2018-07-19 09:52:05 -0700510 {
511
512 if (interface == objectManagerInterface)
513 {
514 owner.second = objectPair.first;
515 }
516 if (interface == pidConfigurationInterface ||
James Feist22c257a2018-08-31 14:07:12 -0700517 interface == pidZoneConfigurationInterface ||
518 interface == stepwiseConfigurationInterface)
James Feist7136a5a2018-07-19 09:52:05 -0700519 {
520 owner.first = true;
521 }
Patrick Venture0911bfe2020-08-10 12:51:40 -0700522 if (interface == sensorInterface ||
523 interface == defaultPwmInterface)
James Feist7136a5a2018-07-19 09:52:05 -0700524 {
525 // we're not interested in pwm sensors, just pwm control
526 if (interface == sensorInterface &&
527 objectPair.first.find("pwm") != std::string::npos)
528 {
529 continue;
530 }
531 sensors[objectPair.first] = interface;
532 }
533 }
534 }
535 }
536 ManagedObjectType configurations;
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700537 for (const auto& owner : owners)
James Feist7136a5a2018-07-19 09:52:05 -0700538 {
539 // skip if no pid configuration (means probably a sensor)
540 if (!owner.second.first)
541 {
542 continue;
543 }
544 auto endpoint = bus.new_method_call(
545 owner.first.c_str(), owner.second.second.c_str(),
546 "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
James Feist22c257a2018-08-31 14:07:12 -0700547 ManagedObjectType configuration;
548 try
James Feist7136a5a2018-07-19 09:52:05 -0700549 {
James Feist22c257a2018-08-31 14:07:12 -0700550 auto responce = bus.call(endpoint);
James Feist22c257a2018-08-31 14:07:12 -0700551 responce.read(configuration);
552 }
553 catch (sdbusplus::exception_t&)
554 {
555 // this shouldn't happen, probably means daemon crashed
James Feist7136a5a2018-07-19 09:52:05 -0700556 throw std::runtime_error("Error getting managed objects from " +
557 owner.first);
558 }
James Feist22c257a2018-08-31 14:07:12 -0700559
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700560 for (auto& pathPair : configuration)
James Feist7136a5a2018-07-19 09:52:05 -0700561 {
562 if (pathPair.second.find(pidConfigurationInterface) !=
563 pathPair.second.end() ||
564 pathPair.second.find(pidZoneConfigurationInterface) !=
James Feist22c257a2018-08-31 14:07:12 -0700565 pathPair.second.end() ||
566 pathPair.second.find(stepwiseConfigurationInterface) !=
James Feist7136a5a2018-07-19 09:52:05 -0700567 pathPair.second.end())
568 {
569 configurations.emplace(pathPair);
570 }
James Feistf0096a02019-02-21 11:25:22 -0800571 }
572 }
573
574 // remove controllers from config that aren't in the current profile(s)
James Feist3987c8b2019-05-13 10:43:17 -0700575 std::vector<std::string> selectedProfiles = getSelectedProfiles(bus);
576 if (selectedProfiles.size())
James Feistf0096a02019-02-21 11:25:22 -0800577 {
James Feist3987c8b2019-05-13 10:43:17 -0700578 for (auto pathIt = configurations.begin();
579 pathIt != configurations.end();)
James Feistf0096a02019-02-21 11:25:22 -0800580 {
James Feist3987c8b2019-05-13 10:43:17 -0700581 for (auto confIt = pathIt->second.begin();
582 confIt != pathIt->second.end();)
James Feistf0096a02019-02-21 11:25:22 -0800583 {
James Feist3987c8b2019-05-13 10:43:17 -0700584 auto profilesFind = confIt->second.find("Profiles");
585 if (profilesFind == confIt->second.end())
James Feistf0096a02019-02-21 11:25:22 -0800586 {
James Feist3987c8b2019-05-13 10:43:17 -0700587 confIt++;
588 continue; // if no profiles selected, apply always
589 }
590 auto profiles =
591 std::get<std::vector<std::string>>(profilesFind->second);
592 if (profiles.empty())
593 {
594 confIt++;
595 continue;
596 }
597
598 bool found = false;
599 for (const std::string& profile : profiles)
600 {
601 if (std::find(selectedProfiles.begin(),
602 selectedProfiles.end(),
603 profile) != selectedProfiles.end())
604 {
605 found = true;
606 break;
607 }
608 }
609 if (found)
610 {
611 confIt++;
James Feistf0096a02019-02-21 11:25:22 -0800612 }
613 else
614 {
James Feist3987c8b2019-05-13 10:43:17 -0700615 confIt = pathIt->second.erase(confIt);
James Feistf0096a02019-02-21 11:25:22 -0800616 }
617 }
James Feist3987c8b2019-05-13 10:43:17 -0700618 if (pathIt->second.empty())
James Feistf0096a02019-02-21 11:25:22 -0800619 {
James Feist3987c8b2019-05-13 10:43:17 -0700620 pathIt = configurations.erase(pathIt);
James Feistf0096a02019-02-21 11:25:22 -0800621 }
James Feist3987c8b2019-05-13 10:43:17 -0700622 else
James Feistf0096a02019-02-21 11:25:22 -0800623 {
James Feist3987c8b2019-05-13 10:43:17 -0700624 pathIt++;
James Feistf0096a02019-02-21 11:25:22 -0800625 }
James Feist7136a5a2018-07-19 09:52:05 -0700626 }
627 }
James Feist8c3c51e2018-08-08 16:31:43 -0700628
629 // on dbus having an index field is a bit strange, so randomly
630 // assign index based on name property
James Feistffd418b2018-11-15 14:46:36 -0800631 std::vector<std::string> foundZones;
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700632 for (const auto& configuration : configurations)
James Feist7136a5a2018-07-19 09:52:05 -0700633 {
634 auto findZone =
635 configuration.second.find(pidZoneConfigurationInterface);
636 if (findZone != configuration.second.end())
637 {
Patrick Venturee2ec0f62018-09-04 12:30:27 -0700638 const auto& zone = findZone->second;
James Feistffd418b2018-11-15 14:46:36 -0800639
James Feist1f802f52019-02-08 13:51:43 -0800640 const std::string& name = std::get<std::string>(zone.at("Name"));
James Feistffd418b2018-11-15 14:46:36 -0800641 size_t index = getZoneIndex(name, foundZones);
James Feist8c3c51e2018-08-08 16:31:43 -0700642
Patrick Venturec54fbd82018-10-30 19:40:05 -0700643 auto& details = zoneDetailsConfig[index];
James Feist3484bed2019-02-25 13:28:18 -0800644 details.minThermalOutput = std::visit(VariantToDoubleVisitor(),
645 zone.at("MinThermalOutput"));
Patrick Venture8e2fdb32019-02-11 09:39:59 -0800646 details.failsafePercent = std::visit(VariantToDoubleVisitor(),
James Feist1f802f52019-02-08 13:51:43 -0800647 zone.at("FailSafePercent"));
James Feist7136a5a2018-07-19 09:52:05 -0700648 }
649 auto findBase = configuration.second.find(pidConfigurationInterface);
Jason Lingf3b04fd2020-07-24 09:33:04 -0700650 // loop through all the PID configurations and fill out a sensor config
James Feist22c257a2018-08-31 14:07:12 -0700651 if (findBase != configuration.second.end())
James Feist7136a5a2018-07-19 09:52:05 -0700652 {
James Feist8c3c51e2018-08-08 16:31:43 -0700653
James Feist22c257a2018-08-31 14:07:12 -0700654 const auto& base =
655 configuration.second.at(pidConfigurationInterface);
Jason Lingf3b04fd2020-07-24 09:33:04 -0700656 const std::string pidName = std::get<std::string>(base.at("Name"));
657 const std::string pidClass =
658 std::get<std::string>(base.at("Class"));
James Feist22c257a2018-08-31 14:07:12 -0700659 const std::vector<std::string>& zones =
James Feist1f802f52019-02-08 13:51:43 -0800660 std::get<std::vector<std::string>>(base.at("Zones"));
James Feist22c257a2018-08-31 14:07:12 -0700661 for (const std::string& zone : zones)
James Feist7136a5a2018-07-19 09:52:05 -0700662 {
James Feistffd418b2018-11-15 14:46:36 -0800663 size_t index = getZoneIndex(zone, foundZones);
James Feistf81f2882019-02-26 11:26:36 -0800664 conf::PIDConf& conf = zoneConfig[index];
Jason Lingf3b04fd2020-07-24 09:33:04 -0700665 std::vector<std::string> inputSensorNames(
666 std::get<std::vector<std::string>>(base.at("Inputs")));
667 std::vector<std::string> outputSensorNames;
James Feist50fdfe32018-09-24 15:51:09 -0700668
Jason Lingf3b04fd2020-07-24 09:33:04 -0700669 // assumption: all fan pids must have at least one output
670 if (pidClass == "fan")
James Feist50fdfe32018-09-24 15:51:09 -0700671 {
Jason Lingf3b04fd2020-07-24 09:33:04 -0700672 outputSensorNames = std::get<std::vector<std::string>>(
673 getPIDAttribute(base, "Outputs"));
James Feist50fdfe32018-09-24 15:51:09 -0700674 }
James Feist1738e2a2019-02-04 15:57:03 -0800675
Jason Lingf3b04fd2020-07-24 09:33:04 -0700676 std::vector<SensorInterfaceType> inputSensorInterfaces;
677 std::vector<SensorInterfaceType> outputSensorInterfaces;
678 /* populate an interface list for different sensor direction
679 * types (input,output)
680 */
681 /* take the Inputs from the configuration and generate
682 * a list of dbus descriptors (path, interface).
683 * Mapping can be many-to-one since an element of Inputs can be
684 * a regex
685 */
686 for (const std::string& sensorName : inputSensorNames)
James Feist50fdfe32018-09-24 15:51:09 -0700687 {
Jason Lingf3b04fd2020-07-24 09:33:04 -0700688 findSensors(sensors, sensorNameToDbusName(sensorName),
689 inputSensorInterfaces);
690 }
691 for (const std::string& sensorName : outputSensorNames)
692 {
693 findSensors(sensors, sensorNameToDbusName(sensorName),
694 outputSensorInterfaces);
James Feist1738e2a2019-02-04 15:57:03 -0800695 }
James Feist50fdfe32018-09-24 15:51:09 -0700696
Jason Lingf3b04fd2020-07-24 09:33:04 -0700697 inputSensorNames.clear();
698 for (const SensorInterfaceType& inputSensorInterface :
699 inputSensorInterfaces)
James Feist1738e2a2019-02-04 15:57:03 -0800700 {
Jason Lingf3b04fd2020-07-24 09:33:04 -0700701 const std::string& dbusInterface =
702 inputSensorInterface.second;
703 const std::string& inputSensorPath =
704 inputSensorInterface.first;
705 std::string inputSensorName =
706 getSensorNameFromPath(inputSensorPath);
707 auto& config = sensorConfig[inputSensorName];
708 inputSensorNames.push_back(inputSensorName);
709 config.type = pidClass;
710 config.readPath = inputSensorInterface.first;
711 // todo: maybe un-hardcode this if we run into slower
712 // timeouts with sensors
713 if (config.type == "temp")
James Feist50fdfe32018-09-24 15:51:09 -0700714 {
Jason Lingf3b04fd2020-07-24 09:33:04 -0700715 config.timeout = 0;
716 config.ignoreDbusMinMax = true;
James Feist50fdfe32018-09-24 15:51:09 -0700717 }
Jason Lingf3b04fd2020-07-24 09:33:04 -0700718 if (dbusInterface != sensorInterface)
James Feist50fdfe32018-09-24 15:51:09 -0700719 {
Jason Lingf3b04fd2020-07-24 09:33:04 -0700720 /* all expected inputs in the configuration are expected
721 * to be sensor interfaces
722 */
723 throw std::runtime_error(
724 "sensor at dbus path [" + inputSensorPath +
725 "] has an interface [" + dbusInterface +
726 "] that does not match the expected interface of " +
727 sensorInterface);
James Feist50fdfe32018-09-24 15:51:09 -0700728 }
729 }
James Feist1738e2a2019-02-04 15:57:03 -0800730
Jason Lingf3b04fd2020-07-24 09:33:04 -0700731 /* fan pids need to pair up tach sensors with their pwm
732 * counterparts
733 */
734 if (pidClass == "fan")
735 {
736 /* If a PID is a fan there should be either
737 * (1) one output(pwm) per input(tach)
738 * OR
739 * (2) one putput(pwm) for all inputs(tach)
740 * everything else indicates a bad configuration.
741 */
742 bool singlePwm = false;
743 if (outputSensorInterfaces.size() == 1)
744 {
745 /* one pwm, set write paths for all fan sensors to it */
746 singlePwm = true;
747 }
748 else if (inputSensorInterfaces.size() ==
749 outputSensorInterfaces.size())
750 {
751 /* one to one mapping, each fan sensor gets its own pwm
752 * control */
753 singlePwm = false;
754 }
755 else
756 {
757 throw std::runtime_error(
758 "fan PID has invalid number of Outputs");
759 }
760 std::string fanSensorName;
761 std::string pwmPath;
762 std::string pwmInterface;
763 if (singlePwm)
764 {
765 /* if just a single output(pwm) is provided then use
766 * that pwm control path for all the fan sensor write
767 * path configs
768 */
769 pwmPath = outputSensorInterfaces.at(0).first;
770 pwmInterface = outputSensorInterfaces.at(0).second;
771 }
772 for (uint32_t idx = 0; idx < inputSensorInterfaces.size();
773 idx++)
774 {
775 if (!singlePwm)
776 {
777 pwmPath = outputSensorInterfaces.at(idx).first;
778 pwmInterface =
779 outputSensorInterfaces.at(idx).second;
780 }
Patrick Venture0911bfe2020-08-10 12:51:40 -0700781 if (defaultPwmInterface != pwmInterface)
Jason Lingf3b04fd2020-07-24 09:33:04 -0700782 {
783 throw std::runtime_error(
784 "fan pwm control at dbus path [" + pwmPath +
785 "] has an interface [" + pwmInterface +
786 "] that does not match the expected interface "
787 "of " +
Patrick Venture0911bfe2020-08-10 12:51:40 -0700788 defaultPwmInterface);
Jason Lingf3b04fd2020-07-24 09:33:04 -0700789 }
790 const std::string& fanPath =
791 inputSensorInterfaces.at(idx).first;
792 fanSensorName = getSensorNameFromPath(fanPath);
793 auto& fanConfig = sensorConfig[fanSensorName];
794 fanConfig.writePath = pwmPath;
795 // todo: un-hardcode this if there are fans with
796 // different ranges
797 fanConfig.max = 255;
798 fanConfig.min = 0;
799 }
800 }
James Feist11d243d2019-06-24 16:18:40 -0700801 // if the sensors aren't available in the current state, don't
802 // add them to the configuration.
Jason Lingf3b04fd2020-07-24 09:33:04 -0700803 if (inputSensorNames.empty())
James Feist11d243d2019-06-24 16:18:40 -0700804 {
805 continue;
806 }
807
James Feist5ec20272019-07-10 11:59:57 -0700808 std::string offsetType;
James Feist50fdfe32018-09-24 15:51:09 -0700809
James Feist5ec20272019-07-10 11:59:57 -0700810 // SetPointOffset is a threshold value to pull from the sensor
811 // to apply an offset. For upper thresholds this means the
812 // setpoint is usually negative.
813 auto findSetpointOffset = base.find("SetPointOffset");
814 if (findSetpointOffset != base.end())
James Feist22c257a2018-08-31 14:07:12 -0700815 {
James Feist5ec20272019-07-10 11:59:57 -0700816 offsetType =
817 std::get<std::string>(findSetpointOffset->second);
818 if (std::find(thresholds::types.begin(),
819 thresholds::types.end(),
820 offsetType) == thresholds::types.end())
821 {
822 throw std::runtime_error("Unsupported type: " +
823 offsetType);
824 }
825 }
826
827 if (offsetType.empty())
828 {
829 struct conf::ControllerInfo& info =
830 conf[std::get<std::string>(base.at("Name"))];
Jason Lingf3b04fd2020-07-24 09:33:04 -0700831 info.inputs = std::move(inputSensorNames);
James Feist5ec20272019-07-10 11:59:57 -0700832 populatePidInfo(bus, base, info, nullptr);
James Feist22c257a2018-08-31 14:07:12 -0700833 }
834 else
835 {
James Feist5ec20272019-07-10 11:59:57 -0700836 // we have to split up the inputs, as in practice t-control
837 // values will differ, making setpoints differ
Jason Lingf3b04fd2020-07-24 09:33:04 -0700838 for (const std::string& input : inputSensorNames)
James Feist5ec20272019-07-10 11:59:57 -0700839 {
840 struct conf::ControllerInfo& info = conf[input];
841 info.inputs.emplace_back(input);
842 populatePidInfo(bus, base, info, &offsetType);
843 }
James Feist22c257a2018-08-31 14:07:12 -0700844 }
James Feist22c257a2018-08-31 14:07:12 -0700845 }
846 }
847 auto findStepwise =
848 configuration.second.find(stepwiseConfigurationInterface);
849 if (findStepwise != configuration.second.end())
850 {
851 const auto& base = findStepwise->second;
852 const std::vector<std::string>& zones =
James Feist1f802f52019-02-08 13:51:43 -0800853 std::get<std::vector<std::string>>(base.at("Zones"));
James Feist22c257a2018-08-31 14:07:12 -0700854 for (const std::string& zone : zones)
855 {
James Feistffd418b2018-11-15 14:46:36 -0800856 size_t index = getZoneIndex(zone, foundZones);
James Feistf81f2882019-02-26 11:26:36 -0800857 conf::PIDConf& conf = zoneConfig[index];
James Feist50fdfe32018-09-24 15:51:09 -0700858
859 std::vector<std::string> inputs;
860 std::vector<std::string> sensorNames =
James Feist1f802f52019-02-08 13:51:43 -0800861 std::get<std::vector<std::string>>(base.at("Inputs"));
James Feist50fdfe32018-09-24 15:51:09 -0700862
James Feist1738e2a2019-02-04 15:57:03 -0800863 bool sensorFound = false;
James Feist50fdfe32018-09-24 15:51:09 -0700864 for (const std::string& sensorName : sensorNames)
865 {
James Feist1738e2a2019-02-04 15:57:03 -0800866 std::vector<std::pair<std::string, std::string>>
867 sensorPathIfacePairs;
Jason Lingf3b04fd2020-07-24 09:33:04 -0700868 if (!findSensors(sensors, sensorNameToDbusName(sensorName),
869 sensorPathIfacePairs))
James Feist50fdfe32018-09-24 15:51:09 -0700870 {
James Feist50fdfe32018-09-24 15:51:09 -0700871 break;
872 }
873
James Feist1738e2a2019-02-04 15:57:03 -0800874 for (const auto& sensorPathIfacePair : sensorPathIfacePairs)
875 {
876 size_t idx =
877 sensorPathIfacePair.first.find_last_of("/") + 1;
878 std::string shortName =
879 sensorPathIfacePair.first.substr(idx);
James Feist50fdfe32018-09-24 15:51:09 -0700880
James Feist1738e2a2019-02-04 15:57:03 -0800881 inputs.push_back(shortName);
882 auto& config = sensorConfig[shortName];
Patrick Venture69c51062019-02-11 09:46:03 -0800883 config.readPath = sensorPathIfacePair.first;
James Feist1738e2a2019-02-04 15:57:03 -0800884 config.type = "temp";
James Feist3660b382019-11-11 16:29:19 -0800885 config.ignoreDbusMinMax = true;
James Feist1738e2a2019-02-04 15:57:03 -0800886 // todo: maybe un-hardcode this if we run into slower
887 // timeouts with sensors
888
James Feist2642cb52019-02-25 13:00:16 -0800889 config.timeout = 0;
James Feist1738e2a2019-02-04 15:57:03 -0800890 sensorFound = true;
891 }
James Feist50fdfe32018-09-24 15:51:09 -0700892 }
893 if (!sensorFound)
894 {
895 continue;
896 }
James Feistf81f2882019-02-26 11:26:36 -0800897 struct conf::ControllerInfo& info =
James Feist1f802f52019-02-08 13:51:43 -0800898 conf[std::get<std::string>(base.at("Name"))];
James Feist50fdfe32018-09-24 15:51:09 -0700899 info.inputs = std::move(inputs);
900
James Feist22c257a2018-08-31 14:07:12 -0700901 info.type = "stepwise";
902 info.stepwiseInfo.ts = 1.0; // currently unused
James Feist3dfaafd2018-09-20 15:46:58 -0700903 info.stepwiseInfo.positiveHysteresis = 0.0;
904 info.stepwiseInfo.negativeHysteresis = 0.0;
James Feist608304d2019-02-25 10:01:42 -0800905 std::string subtype = std::get<std::string>(base.at("Class"));
906
907 info.stepwiseInfo.isCeiling = (subtype == "Ceiling");
James Feist3dfaafd2018-09-20 15:46:58 -0700908 auto findPosHyst = base.find("PositiveHysteresis");
909 auto findNegHyst = base.find("NegativeHysteresis");
910 if (findPosHyst != base.end())
911 {
James Feist1f802f52019-02-08 13:51:43 -0800912 info.stepwiseInfo.positiveHysteresis = std::visit(
James Feist208abce2018-12-06 09:59:10 -0800913 VariantToDoubleVisitor(), findPosHyst->second);
James Feist3dfaafd2018-09-20 15:46:58 -0700914 }
915 if (findNegHyst != base.end())
916 {
James Feist5782ab82019-04-02 08:38:48 -0700917 info.stepwiseInfo.negativeHysteresis = std::visit(
James Feist208abce2018-12-06 09:59:10 -0800918 VariantToDoubleVisitor(), findNegHyst->second);
James Feist3dfaafd2018-09-20 15:46:58 -0700919 }
James Feist22c257a2018-08-31 14:07:12 -0700920 std::vector<double> readings =
James Feist1f802f52019-02-08 13:51:43 -0800921 std::get<std::vector<double>>(base.at("Reading"));
James Feist22c257a2018-08-31 14:07:12 -0700922 if (readings.size() > ec::maxStepwisePoints)
923 {
924 throw std::invalid_argument("Too many stepwise points.");
925 }
926 if (readings.empty())
927 {
928 throw std::invalid_argument(
929 "Must have one stepwise point.");
930 }
931 std::copy(readings.begin(), readings.end(),
932 info.stepwiseInfo.reading);
933 if (readings.size() < ec::maxStepwisePoints)
934 {
935 info.stepwiseInfo.reading[readings.size()] =
Patrick Venture5f59c0f2018-11-11 12:55:14 -0800936 std::numeric_limits<double>::quiet_NaN();
James Feist22c257a2018-08-31 14:07:12 -0700937 }
938 std::vector<double> outputs =
James Feist1f802f52019-02-08 13:51:43 -0800939 std::get<std::vector<double>>(base.at("Output"));
James Feist22c257a2018-08-31 14:07:12 -0700940 if (readings.size() != outputs.size())
941 {
942 throw std::invalid_argument(
943 "Outputs size must match readings");
944 }
945 std::copy(outputs.begin(), outputs.end(),
946 info.stepwiseInfo.output);
947 if (outputs.size() < ec::maxStepwisePoints)
948 {
949 info.stepwiseInfo.output[outputs.size()] =
Patrick Venture5f59c0f2018-11-11 12:55:14 -0800950 std::numeric_limits<double>::quiet_NaN();
James Feist22c257a2018-08-31 14:07:12 -0700951 }
James Feist7136a5a2018-07-19 09:52:05 -0700952 }
953 }
954 }
James Feistf0096a02019-02-21 11:25:22 -0800955 if constexpr (DEBUG)
James Feist7136a5a2018-07-19 09:52:05 -0700956 {
957 debugPrint();
958 }
James Feistc959c422018-11-01 12:33:40 -0700959 if (zoneConfig.empty() || zoneDetailsConfig.empty())
James Feist50fdfe32018-09-24 15:51:09 -0700960 {
James Feist1fe08952019-05-07 09:17:16 -0700961 std::cerr
962 << "No fan zones, application pausing until new configuration\n";
963 return false;
James Feist50fdfe32018-09-24 15:51:09 -0700964 }
James Feist1fe08952019-05-07 09:17:16 -0700965 return true;
James Feist7136a5a2018-07-19 09:52:05 -0700966}
Patrick Venturea0764872020-08-08 07:48:43 -0700967
James Feist7136a5a2018-07-19 09:52:05 -0700968} // namespace dbus_configuration
Patrick Venturea0764872020-08-08 07:48:43 -0700969} // namespace pid_control