summaryrefslogtreecommitdiffstats
path: root/sensordatahandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sensordatahandler.cpp')
-rw-r--r--sensordatahandler.cpp44
1 files changed, 33 insertions, 11 deletions
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 7db8fe0..4d87341 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -256,33 +256,55 @@ ipmi_ret_t eventdata(const SetSensorReadingReq& cmdData,
ipmi_ret_t assertion(const SetSensorReadingReq& cmdData,
const Info& sensorInfo)
{
- auto msg = makeDbusMsg(
- "org.freedesktop.DBus.Properties",
- sensorInfo.sensorPath,
- "Set",
- sensorInfo.sensorInterface);
-
std::bitset<16> assertionSet(getAssertionSet(cmdData).first);
std::bitset<16> deassertionSet(getAssertionSet(cmdData).second);
+ auto bothSet = assertionSet ^ deassertionSet;
const auto& interface = sensorInfo.propertyInterfaces.begin();
- msg.append(interface->first);
+
for (const auto& property : interface->second)
{
- msg.append(property.first);
+ Value tmp{mapbox::util::no_init()};
for (const auto& value : std::get<OffsetValueMap>(property.second))
{
+ if (bothSet.size() <= value.first || !bothSet.test(value.first))
+ {
+ // A BIOS shouldn't do this but ignore if they do.
+ continue;
+ }
+
if (assertionSet.test(value.first))
{
- msg.append(value.second.assert);
+ tmp = value.second.assert;
+ break;
}
if (deassertionSet.test(value.first))
{
- msg.append(value.second.deassert);
+ tmp = value.second.deassert;
+ break;
+ }
+ }
+
+ if (tmp.valid())
+ {
+ auto msg = makeDbusMsg(
+ "org.freedesktop.DBus.Properties",
+ sensorInfo.sensorPath,
+ "Set",
+ sensorInfo.sensorInterface);
+ msg.append(interface->first);
+ msg.append(property.first);
+ msg.append(tmp);
+
+ auto rc = updateToDbus(msg);
+ if (rc)
+ {
+ return rc;
}
}
}
- return updateToDbus(msg);
+
+ return IPMI_CC_OK;
}
}//namespace set
OpenPOWER on IntegriCloud