bare-metal-host-monitor: capture state and action
state/action needs to be captured by value instead of reference.
Change-Id: I68dbc5bd91979b9fc21e7911a4b6b1433a9852ba
Signed-off-by: Yuxiao Zhang <yuxiaozhang@google.com>
diff --git a/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp b/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
index 889ab93..36a0ec3 100644
--- a/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
+++ b/subprojects/bare-metal-host-monitor/host_gpio_monitor.cpp
@@ -34,15 +34,14 @@
bus.call(method);
}
-/* This only gets called once on startup. */
void checkPostComplete(sdbusplus::asio::connection& bus,
const std::string& state, bool action)
{
sdbusplus::asio::getProperty<std::string>(
bus, OperatingSystemService, OperatingSystemPath,
OperatingSystemStatusInterface, OperatingSystemStateProperty,
- [&](const boost::system::error_code& ec,
- const std::string& postCompleteState) {
+ [&, state, action](const boost::system::error_code& ec,
+ const std::string& postCompleteState) {
if (ec)
{
lg2::error("Error when checking Post Complete GPIO state");
@@ -50,6 +49,7 @@
}
lg2::info("Post Complete state is {STATE}", "STATE", postCompleteState);
+
/*
* If state is Standby, enable the bare-metal-active systemd
* target.