diff options
| author | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-01-06 09:47:41 -0500 |
|---|---|---|
| committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2017-01-13 16:26:06 -0500 |
| commit | 473785088e1e7279b7d7800da3d9a28d22fe77dc (patch) | |
| tree | f424300132c0bd3525b213a5458d153378ccf7b0 /mainloop.cpp | |
| parent | cc56cd9e03bb32e3ed330fde68e54ca0c8588122 (diff) | |
| download | phosphor-hwmon-473785088e1e7279b7d7800da3d9a28d22fe77dc.tar.gz phosphor-hwmon-473785088e1e7279b7d7800da3d9a28d22fe77dc.zip | |
Set sensor initial value.
Set the initial value of the value property in the
Sensor.Value interface.
Change-Id: I1324d3172d1f69cf90f59a065327ab8f739243ed
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'mainloop.cpp')
| -rw-r--r-- | mainloop.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mainloop.cpp b/mainloop.cpp index 3ba365c..a6758d4 100644 --- a/mainloop.cpp +++ b/mainloop.cpp @@ -74,6 +74,15 @@ void MainLoop::run() continue; } + // Get the initial value for the value interface. + auto sysfsPath = make_sysfs_path( + _path, + i.first.first, + i.first.second, + hwmon::entry::input); + int val = 0; + read_sysfs(sysfsPath, val); + Object o; std::string objectPath{_root}; @@ -83,6 +92,7 @@ void MainLoop::run() objectPath.append(label); auto iface = std::make_shared<ValueObject>(_bus, objectPath.c_str()); + iface->value(val); o.emplace(InterfaceType::VALUE, iface); auto value = std::make_tuple( |

