blob: 62918133b38c1811c55072b732cbc420b284d684 [file] [log] [blame]
Brad Bishope55ef3d2016-12-19 09:12:40 -05001/**
2 * Copyright © 2016 IBM 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#include <iostream>
17#include <memory>
Brad Bishop9c7b6e02016-12-19 12:43:36 -050018#include <cstdlib>
Chiabing Leec923ce92017-09-06 15:58:26 +080019#include <string>
Patrick Venture1e6324f2017-06-01 14:07:05 -070020
21#include <phosphor-logging/elog-errors.hpp>
Matt Spinlerf9c83c42017-08-10 08:51:45 -050022#include "config.h"
Brad Bishope55ef3d2016-12-19 09:12:40 -050023#include "sensorset.hpp"
Brad Bishope55ef3d2016-12-19 09:12:40 -050024#include "hwmon.hpp"
25#include "sysfs.hpp"
Brad Bishopd499ca62016-12-19 09:24:50 -050026#include "mainloop.hpp"
Brad Bishopf3df6b42017-01-06 10:14:09 -050027#include "env.hpp"
Brad Bishope0b7d052017-01-06 15:30:23 -050028#include "thresholds.hpp"
Matthew Barthbf7b7b12017-03-07 15:46:59 -060029#include "targets.hpp"
Matthew Barth048ac872017-03-09 14:36:08 -060030#include "fan_speed.hpp"
Brad Bishope55ef3d2016-12-19 09:12:40 -050031
Patrick Venture1e6324f2017-06-01 14:07:05 -070032#include <xyz/openbmc_project/Sensor/Device/error.hpp>
33
34using namespace phosphor::logging;
35
Saqib Khan973886d2017-03-15 14:01:16 -050036// Initialization for Warning Objects
37decltype(Thresholds<WarningObject>::setLo) Thresholds<WarningObject>::setLo =
38 &WarningObject::warningLow;
39decltype(Thresholds<WarningObject>::setHi) Thresholds<WarningObject>::setHi =
40 &WarningObject::warningHigh;
41decltype(Thresholds<WarningObject>::getLo) Thresholds<WarningObject>::getLo =
42 &WarningObject::warningLow;
43decltype(Thresholds<WarningObject>::getHi) Thresholds<WarningObject>::getHi =
44 &WarningObject::warningHigh;
45decltype(Thresholds<WarningObject>::alarmLo) Thresholds<WarningObject>::alarmLo =
46 &WarningObject::warningAlarmLow;
47decltype(Thresholds<WarningObject>::alarmHi) Thresholds<WarningObject>::alarmHi =
48 &WarningObject::warningAlarmHigh;
49
50// Initialization for Critical Objects
51decltype(Thresholds<CriticalObject>::setLo) Thresholds<CriticalObject>::setLo =
52 &CriticalObject::criticalLow;
53decltype(Thresholds<CriticalObject>::setHi) Thresholds<CriticalObject>::setHi =
54 &CriticalObject::criticalHigh;
55decltype(Thresholds<CriticalObject>::getLo) Thresholds<CriticalObject>::getLo =
56 &CriticalObject::criticalLow;
57decltype(Thresholds<CriticalObject>::getHi) Thresholds<CriticalObject>::getHi =
58 &CriticalObject::criticalHigh;
59decltype(Thresholds<CriticalObject>::alarmLo) Thresholds<CriticalObject>::alarmLo =
60 &CriticalObject::criticalAlarmLow;
61decltype(Thresholds<CriticalObject>::alarmHi) Thresholds<CriticalObject>::alarmHi =
62 &CriticalObject::criticalAlarmHigh;
63
Chiabing Leec923ce92017-09-06 15:58:26 +080064// The gain and offset to adjust a value
65struct valueAdjust
66{
67 double gain = 1.0;
68 int offset = 0;
69};
70
71// Store the valueAdjust for sensors
72std::map<SensorSet::key_type, valueAdjust> sensorAdjusts;
73
Brad Bishop74aa4dd2017-01-06 09:50:31 -050074static constexpr auto typeAttrMap =
75{
76 // 1 - hwmon class
77 // 2 - unit
78 // 3 - sysfs scaling factor
79 std::make_tuple(
80 hwmon::type::ctemp,
81 ValueInterface::Unit::DegreesC,
Brad Bishopadd98512017-01-06 22:01:19 -050082 -3,
83 "temperature"),
Brad Bishop74aa4dd2017-01-06 09:50:31 -050084 std::make_tuple(
85 hwmon::type::cfan,
86 ValueInterface::Unit::RPMS,
Brad Bishopadd98512017-01-06 22:01:19 -050087 0,
88 "fan_tach"),
Brad Bishop74aa4dd2017-01-06 09:50:31 -050089 std::make_tuple(
90 hwmon::type::cvolt,
91 ValueInterface::Unit::Volts,
Brad Bishopadd98512017-01-06 22:01:19 -050092 -3,
93 "voltage"),
Brad Bishop5afe21a2017-01-06 20:44:05 -050094 std::make_tuple(
95 hwmon::type::ccurr,
96 ValueInterface::Unit::Amperes,
Brad Bishopadd98512017-01-06 22:01:19 -050097 -3,
98 "current"),
Brad Bishop5afe21a2017-01-06 20:44:05 -050099 std::make_tuple(
100 hwmon::type::cenergy,
101 ValueInterface::Unit::Joules,
Brad Bishopadd98512017-01-06 22:01:19 -0500102 -6,
103 "energy"),
Brad Bishop5afe21a2017-01-06 20:44:05 -0500104 std::make_tuple(
105 hwmon::type::cpower,
106 ValueInterface::Unit::Watts,
Brad Bishopadd98512017-01-06 22:01:19 -0500107 -6,
108 "power"),
Brad Bishop74aa4dd2017-01-06 09:50:31 -0500109};
110
111auto getHwmonType(decltype(typeAttrMap)::const_reference attrs)
112{
113 return std::get<0>(attrs);
114}
115
116auto getUnit(decltype(typeAttrMap)::const_reference attrs)
117{
118 return std::get<1>(attrs);
119}
120
121auto getScale(decltype(typeAttrMap)::const_reference attrs)
122{
123 return std::get<2>(attrs);
124}
125
Brad Bishopadd98512017-01-06 22:01:19 -0500126auto getNamespace(decltype(typeAttrMap)::const_reference attrs)
127{
128 return std::get<3>(attrs);
129}
130
Brad Bishop951a79e2017-01-06 21:55:11 -0500131using AttributeIterator = decltype(*typeAttrMap.begin());
132using Attributes
133 = std::remove_cv<std::remove_reference<AttributeIterator>::type>::type;
134
135auto getAttributes(const std::string& type, Attributes& attributes)
136{
137 // *INDENT-OFF*
138 auto a = std::find_if(
139 typeAttrMap.begin(),
140 typeAttrMap.end(),
141 [&](const auto & e)
142 {
143 return type == getHwmonType(e);
144 });
145 // *INDENT-ON*
146
147 if (a == typeAttrMap.end())
148 {
149 return false;
150 }
151
152 attributes = *a;
153 return true;
154}
155
Chiabing Leec923ce92017-09-06 15:58:26 +0800156int adjustValue(const SensorSet::key_type& sensor, int value)
157{
158 const auto& it = sensorAdjusts.find(sensor);
159 if (it != sensorAdjusts.end())
160 {
161 // Adjust based on gain and offset
162 value = static_cast<decltype(value)>(
163 static_cast<double>(value) * it->second.gain
164 + it->second.offset);
165 }
166 return value;
167}
168
Brad Bishope9fdee02017-01-06 10:43:29 -0500169auto addValue(const SensorSet::key_type& sensor,
Brad Bishop751043e2017-08-29 11:13:46 -0400170 const std::string& devPath,
171 sysfs::hwmonio::HwmonIO& ioAccess,
Brad Bishop4db64422017-02-16 11:33:32 -0500172 ObjectInfo& info)
Brad Bishope9fdee02017-01-06 10:43:29 -0500173{
Brad Bishop30dbcee2017-01-18 07:55:42 -0500174 static constexpr bool deferSignals = true;
175
Brad Bishope9fdee02017-01-06 10:43:29 -0500176 // Get the initial value for the value interface.
177 auto& bus = *std::get<sdbusplus::bus::bus*>(info);
178 auto& obj = std::get<Object>(info);
179 auto& objPath = std::get<std::string>(info);
180
Brad Bishop751043e2017-08-29 11:13:46 -0400181 auto val = 0;
182 try
183 {
184 // Retry for up to a second if device is busy
Brad Bishop754d38c2017-09-08 00:46:58 -0400185 // or has a transient error.
186 val = ioAccess.read(
Brad Bishop751043e2017-08-29 11:13:46 -0400187 sensor.first,
188 sensor.second,
Brad Bishop754d38c2017-09-08 00:46:58 -0400189 hwmon::entry::cinput,
190 sysfs::hwmonio::retries,
191 sysfs::hwmonio::delay);
Brad Bishop751043e2017-08-29 11:13:46 -0400192 }
193 catch (const std::system_error& e)
194 {
195 using namespace sdbusplus::xyz::openbmc_project::Sensor::Device::Error;
196 report<ReadFailure>(
197 xyz::openbmc_project::Sensor::Device::
198 ReadFailure::CALLOUT_ERRNO(e.code().value()),
199 xyz::openbmc_project::Sensor::Device::
200 ReadFailure::CALLOUT_DEVICE_PATH(devPath.c_str()));
201
Matt Spinler9b65f762017-10-05 10:36:22 -0500202 auto file = sysfs::make_sysfs_path(
203 ioAccess.path(),
204 sensor.first,
205 sensor.second,
206 hwmon::entry::cinput);
207
208 log<level::INFO>("Logging failing sysfs file",
209 entry("FILE=%s", file.c_str()));
210
Brad Bishop751043e2017-08-29 11:13:46 -0400211 return static_cast<std::shared_ptr<ValueObject>>(nullptr);
Patrick Venture1e6324f2017-06-01 14:07:05 -0700212 }
213
Chiabing Leec923ce92017-09-06 15:58:26 +0800214 auto gain = getEnv("GAIN", sensor);
215 if (!gain.empty())
216 {
217 sensorAdjusts[sensor].gain = std::stod(gain);
218 }
219
220 auto offset = getEnv("OFFSET", sensor);
221 if (!offset.empty())
222 {
223 sensorAdjusts[sensor].offset = std::stoi(offset);
224 }
225
226 val = adjustValue(sensor, val);
227
Brad Bishop30dbcee2017-01-18 07:55:42 -0500228 auto iface = std::make_shared<ValueObject>(bus, objPath.c_str(), deferSignals);
Brad Bishope9fdee02017-01-06 10:43:29 -0500229 iface->value(val);
230
Brad Bishop951a79e2017-01-06 21:55:11 -0500231 Attributes attrs;
232 if (getAttributes(sensor.first, attrs))
Brad Bishope9fdee02017-01-06 10:43:29 -0500233 {
Brad Bishop951a79e2017-01-06 21:55:11 -0500234 iface->unit(getUnit(attrs));
235 iface->scale(getScale(attrs));
Brad Bishope9fdee02017-01-06 10:43:29 -0500236 }
237
238 obj[InterfaceType::VALUE] = iface;
239 return iface;
240}
241
Brad Bishopb9e2b072016-12-19 13:47:10 -0500242MainLoop::MainLoop(
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500243 sdbusplus::bus::bus&& bus,
Brad Bishopb9e2b072016-12-19 13:47:10 -0500244 const std::string& path,
Brad Bishopf3aa9ae2017-08-25 09:56:02 -0400245 const std::string& devPath,
Brad Bishopb9e2b072016-12-19 13:47:10 -0500246 const char* prefix,
247 const char* root)
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500248 : _bus(std::move(bus)),
Brad Bishop03e87352017-03-07 00:12:22 -0500249 _manager(_bus, root),
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500250 _shutdown(false),
Brad Bishopb8740fc2017-02-24 23:38:37 -0500251 _hwmonRoot(),
252 _instance(),
Brad Bishopf3aa9ae2017-08-25 09:56:02 -0400253 _devPath(devPath),
Brad Bishopb9e2b072016-12-19 13:47:10 -0500254 _prefix(prefix),
Brad Bishop3c344d32017-01-05 11:48:39 -0500255 _root(root),
Brad Bishop751043e2017-08-29 11:13:46 -0400256 state(),
257 ioAccess(path)
Brad Bishopd499ca62016-12-19 09:24:50 -0500258{
Brad Bishopb8740fc2017-02-24 23:38:37 -0500259 std::string p = path;
260 while (!p.empty() && p.back() == '/')
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500261 {
Brad Bishopb8740fc2017-02-24 23:38:37 -0500262 p.pop_back();
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500263 }
Brad Bishopb8740fc2017-02-24 23:38:37 -0500264
265 auto n = p.rfind('/');
266 if (n != std::string::npos)
267 {
268 _instance.assign(p.substr(n + 1));
269 _hwmonRoot.assign(p.substr(0, n));
270 }
271
272 assert(!_instance.empty());
273 assert(!_hwmonRoot.empty());
Brad Bishopd499ca62016-12-19 09:24:50 -0500274}
275
276void MainLoop::shutdown() noexcept
277{
278 _shutdown = true;
279}
280
281void MainLoop::run()
Brad Bishope55ef3d2016-12-19 09:12:40 -0500282{
283 // Check sysfs for available sensors.
Brad Bishop4db64422017-02-16 11:33:32 -0500284 auto sensors = std::make_unique<SensorSet>(_hwmonRoot + '/' + _instance);
Brad Bishope55ef3d2016-12-19 09:12:40 -0500285
Brad Bishop75b4ab82017-01-06 09:33:50 -0500286 for (auto& i : *sensors)
287 {
Tom Joseph1f8a9582017-06-12 20:10:59 +0530288 std::string label;
Brad Bishopf3df6b42017-01-06 10:14:09 -0500289
Tom Joseph1f8a9582017-06-12 20:10:59 +0530290 /*
291 * Check if the value of the MODE_<item><X> env variable for the sensor
292 * is "label", then read the sensor number from the <item><X>_label
293 * file. The name of the DBUS object would be the value of the env
294 * variable LABEL_<item><sensorNum>. If the MODE_<item><X> env variable
295 * does'nt exist, then the name of DBUS object is the value of the env
296 * variable LABEL_<item><X>.
297 */
298 auto mode = getEnv("MODE", i.first);
299 if (!mode.compare(hwmon::entry::label))
Brad Bishop73831cd2017-01-06 09:37:22 -0500300 {
Tom Joseph1f8a9582017-06-12 20:10:59 +0530301 label = getIndirectLabelEnv(
302 "LABEL", _hwmonRoot + '/' + _instance + '/', i.first);
303 if (label.empty())
304 {
305 continue;
306 }
307 }
308 else
309 {
310 // Ignore inputs without a label.
311 label = getEnv("LABEL", i.first);
312 if (label.empty())
313 {
314 continue;
315 }
Brad Bishop73831cd2017-01-06 09:37:22 -0500316 }
317
Brad Bishopadd98512017-01-06 22:01:19 -0500318 Attributes attrs;
319 if (!getAttributes(i.first.first, attrs))
320 {
321 continue;
322 }
323
Brad Bishop075f7a22017-01-06 09:45:08 -0500324 std::string objectPath{_root};
Brad Bishopb8740fc2017-02-24 23:38:37 -0500325 objectPath.append(1, '/');
Brad Bishopadd98512017-01-06 22:01:19 -0500326 objectPath.append(getNamespace(attrs));
Brad Bishopb8740fc2017-02-24 23:38:37 -0500327 objectPath.append(1, '/');
Brad Bishop075f7a22017-01-06 09:45:08 -0500328 objectPath.append(label);
329
Brad Bishopf7426cf2017-01-06 15:36:43 -0500330 ObjectInfo info(&_bus, std::move(objectPath), Object());
Brad Bishop751043e2017-08-29 11:13:46 -0400331 auto valueInterface = addValue(i.first, _devPath, ioAccess, info);
Patrick Venture1e6324f2017-06-01 14:07:05 -0700332 if (!valueInterface)
333 {
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500334#ifdef REMOVE_ON_FAIL
Patrick Venture1e6324f2017-06-01 14:07:05 -0700335 continue; /* skip adding this sensor for now. */
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500336#else
337 exit(EXIT_FAILURE);
338#endif
Patrick Venture1e6324f2017-06-01 14:07:05 -0700339 }
Brad Bishope0b7d052017-01-06 15:30:23 -0500340 auto sensorValue = valueInterface->value();
341 addThreshold<WarningObject>(i.first, sensorValue, info);
342 addThreshold<CriticalObject>(i.first, sensorValue, info);
Matt Spinlera3eb8e32017-10-12 16:42:49 -0500343
Matt Spinler0a8de642017-05-11 10:59:39 -0500344 auto target = addTarget<hwmon::FanSpeed>(
Brad Bishop751043e2017-08-29 11:13:46 -0400345 i.first, ioAccess.path(), _devPath, info);
Matt Spinler0a8de642017-05-11 10:59:39 -0500346
347 if (target)
348 {
349 target->enable();
350 }
Brad Bishop075f7a22017-01-06 09:45:08 -0500351
Brad Bishop30dbcee2017-01-18 07:55:42 -0500352 // All the interfaces have been created. Go ahead
353 // and emit InterfacesAdded.
354 valueInterface->emit_object_added();
355
Brad Bishop075f7a22017-01-06 09:45:08 -0500356 auto value = std::make_tuple(
357 std::move(i.second),
358 std::move(label),
Brad Bishopf7426cf2017-01-06 15:36:43 -0500359 std::move(info));
Brad Bishop73831cd2017-01-06 09:37:22 -0500360
Brad Bishop75b4ab82017-01-06 09:33:50 -0500361 state[std::move(i.first)] = std::move(value);
362 }
363
Patrick Venture62503a42017-05-23 07:30:29 -0700364 /* If there are no sensors specified by labels, exit. */
365 if (0 == state.size())
366 {
367 return;
368 }
369
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500370 {
Brad Bishopb8740fc2017-02-24 23:38:37 -0500371 std::string busname{_prefix};
372 busname.append(1, '.');
373 busname.append(_instance);
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500374 _bus.request_name(busname.c_str());
375 }
376
Patrick Ventureab10f162017-05-22 09:44:50 -0700377 {
378 auto interval = getenv("INTERVAL");
379 if (interval)
380 {
381 _interval = strtoull(interval, NULL, 10);
382 }
383 }
384
Brad Bishope55ef3d2016-12-19 09:12:40 -0500385 // TODO: Issue#3 - Need to make calls to the dbus sensor cache here to
386 // ensure the objects all exist?
387
388 // Polling loop.
Brad Bishopd499ca62016-12-19 09:24:50 -0500389 while (!_shutdown)
Brad Bishope55ef3d2016-12-19 09:12:40 -0500390 {
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500391#ifdef REMOVE_ON_FAIL
Patrick Venture1e6324f2017-06-01 14:07:05 -0700392 std::vector<SensorSet::key_type> destroy;
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500393#endif
Brad Bishope55ef3d2016-12-19 09:12:40 -0500394 // Iterate through all the sensors.
Brad Bishop75b4ab82017-01-06 09:33:50 -0500395 for (auto& i : state)
Brad Bishope55ef3d2016-12-19 09:12:40 -0500396 {
Brad Bishop75b4ab82017-01-06 09:33:50 -0500397 auto& attrs = std::get<0>(i.second);
398 if (attrs.find(hwmon::entry::input) != attrs.end())
Brad Bishope55ef3d2016-12-19 09:12:40 -0500399 {
400 // Read value from sensor.
Patrick Venture1e6324f2017-06-01 14:07:05 -0700401 int value;
402 try
Brad Bishopdddb7152017-01-06 09:54:23 -0500403 {
Brad Bishop754d38c2017-09-08 00:46:58 -0400404 // Retry for up to a second if device is busy
405 // or has a transient error.
406
Brad Bishop751043e2017-08-29 11:13:46 -0400407 value = ioAccess.read(
408 i.first.first,
409 i.first.second,
Brad Bishop754d38c2017-09-08 00:46:58 -0400410 hwmon::entry::cinput,
411 sysfs::hwmonio::retries,
412 sysfs::hwmonio::delay);
Brad Bishope0b7d052017-01-06 15:30:23 -0500413
Chiabing Leec923ce92017-09-06 15:58:26 +0800414 value = adjustValue(i.first, value);
415
Patrick Venture1e6324f2017-06-01 14:07:05 -0700416 auto& objInfo = std::get<ObjectInfo>(i.second);
417 auto& obj = std::get<Object>(objInfo);
418
419 for (auto& iface : obj)
Brad Bishope0b7d052017-01-06 15:30:23 -0500420 {
Patrick Venture1e6324f2017-06-01 14:07:05 -0700421 auto valueIface = std::shared_ptr<ValueObject>();
422 auto warnIface = std::shared_ptr<WarningObject>();
423 auto critIface = std::shared_ptr<CriticalObject>();
424
425 switch (iface.first)
426 {
427 case InterfaceType::VALUE:
428 valueIface = std::experimental::any_cast<std::shared_ptr<ValueObject>>
429 (iface.second);
430 valueIface->value(value);
431 break;
432 case InterfaceType::WARN:
433 checkThresholds<WarningObject>(iface.second, value);
434 break;
435 case InterfaceType::CRIT:
436 checkThresholds<CriticalObject>(iface.second, value);
437 break;
438 default:
439 break;
440 }
Brad Bishope0b7d052017-01-06 15:30:23 -0500441 }
Brad Bishopdddb7152017-01-06 09:54:23 -0500442 }
Brad Bishop751043e2017-08-29 11:13:46 -0400443 catch (const std::system_error& e)
Patrick Venture1e6324f2017-06-01 14:07:05 -0700444 {
Brad Bishop751043e2017-08-29 11:13:46 -0400445 using namespace sdbusplus::xyz::openbmc_project::
446 Sensor::Device::Error;
447 report<ReadFailure>(
448 xyz::openbmc_project::Sensor::Device::
449 ReadFailure::CALLOUT_ERRNO(e.code().value()),
450 xyz::openbmc_project::Sensor::Device::
451 ReadFailure::CALLOUT_DEVICE_PATH(
452 _devPath.c_str()));
Matt Spinler9b65f762017-10-05 10:36:22 -0500453
454 auto file = sysfs::make_sysfs_path(
455 ioAccess.path(),
456 i.first.first,
457 i.first.second,
458 hwmon::entry::cinput);
459
460 log<level::INFO>("Logging failing sysfs file",
461 entry("FILE=%s", file.c_str()));
462
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500463#ifdef REMOVE_ON_FAIL
Patrick Venture1e6324f2017-06-01 14:07:05 -0700464 destroy.push_back(i.first);
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500465#else
466 exit(EXIT_FAILURE);
467#endif
Patrick Venture1e6324f2017-06-01 14:07:05 -0700468 }
Brad Bishope55ef3d2016-12-19 09:12:40 -0500469 }
470 }
471
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500472#ifdef REMOVE_ON_FAIL
Patrick Venture1e6324f2017-06-01 14:07:05 -0700473 for (auto& i : destroy)
474 {
475 state.erase(i);
476 }
Matt Spinlerf9c83c42017-08-10 08:51:45 -0500477#endif
Patrick Venture1e6324f2017-06-01 14:07:05 -0700478
Brad Bishop9c7b6e02016-12-19 12:43:36 -0500479 // Respond to DBus
480 _bus.process_discard();
481
Brad Bishope55ef3d2016-12-19 09:12:40 -0500482 // Sleep until next interval.
Brad Bishope55ef3d2016-12-19 09:12:40 -0500483 // TODO: Issue#6 - Optionally look at polling interval sysfs entry.
Patrick Ventureab10f162017-05-22 09:44:50 -0700484 _bus.wait(_interval);
Brad Bishope55ef3d2016-12-19 09:12:40 -0500485
486 // TODO: Issue#7 - Should probably periodically check the SensorSet
487 // for new entries.
488 }
Brad Bishope55ef3d2016-12-19 09:12:40 -0500489}
490
491// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4