From 16a84c977b6a360d7f6a12f578d0480f4c00ec76 Mon Sep 17 00:00:00 2001 From: "Wang.Bin" Date: Thu, 19 Dec 2024 15:42:26 +0800 Subject: [PATCH 6/6] Fix sensor status being cleared due to warm reset during the power on --- fault-monitor/fru-fault-monitor.cpp | 36 +++++++++++++++++++++++++++++ fault-monitor/fru-fault-monitor.hpp | 12 +++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp index 1bc41aa..f8cac9b 100644 --- a/fault-monitor/fru-fault-monitor.cpp +++ b/fault-monitor/fru-fault-monitor.cpp @@ -1632,6 +1632,37 @@ void Add::clearFirmwareProgressAlarm(SensorStatusInfo& statusInfo) void Add::deassertOnPowerReset(void) { + std::cout << "Get the current host state" < propertyValue{}; + std::string value; + try + { + auto reply = bus.call(method); + reply.read(propertyValue); + value = std::get(propertyValue); + std::cerr << "value:" << value << "\n"; + } + catch (const std::exception& e) + { + std::cerr << "exception:" << e.what() << "\n"; + } + + if (value == "xyz.openbmc_project.State.Host.HostState.Running"){ + std::cout << "power on:Do not clear the sensor status" <(findState->second); + if (status.size() >= running.size()) + { + isPoweredOn = + (status.compare(status.size() - running.size(), + running.size(), running.data()) == 0); + if (!isPoweredOn) + { + deassertOnPowerReset(); + } + } } }), dimmLEDMatch(bus, -- 2.25.1