From 1d69e19255e4195f85539200842d88c0dec426f1 Mon Sep 17 00:00:00 2001 From: Alexander Filippov Date: Thu, 21 Mar 2019 18:12:07 +0300 Subject: Add support for sensorName field in yaml We want to have ability to specify the human readable names for the OCC sensors. E.g. `CPU0_OCC` instead of `occ_4_0050`. This commit allows to specify a `sensorName` field in the YAML config for each sensor, and this name will be used in the sensor object DBus path. If the field is not specified, previous behavior will be used. Tested: the command `busctl tree org.open_power.OCC.Control --list` must show specified names. Change-Id: I2f05f7bf44120554ea07b9ee0aac9cfbd33ac376 Signed-off-by: Alexander Filippov --- occ_status.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'occ_status.cpp') diff --git a/occ_status.cpp b/occ_status.cpp index c2c4bae..0782f87 100644 --- a/occ_status.cpp +++ b/occ_status.cpp @@ -95,7 +95,8 @@ void Status::resetOCC() method.append(convertForMessage(Control::Host::Command::OCCReset).c_str()); // OCC Sensor ID for callout reasons - method.append(sdbusplus::message::variant(sensorMap.at(instance))); + method.append(sdbusplus::message::variant( + std::get<0>(sensorMap.at(instance)))); bus.call_noreply(method); return; } @@ -122,9 +123,9 @@ void Status::hostControlEvent(sdbusplus::message::message& msg) Control::Host::Command::OCCReset) { // Must be a Timeout. Log an Error trace - log("Error resetting the OCC.", - entry("PATH=%s", path.c_str()), - entry("SENSORID=0x%X", sensorMap.at(instance))); + log( + "Error resetting the OCC.", entry("PATH=%s", path.c_str()), + entry("SENSORID=0x%X", std::get<0>(sensorMap.at(instance)))); } } return; -- cgit v1.2.1