From 2029106af90bcdfd6a640a21c2c2eff36cb95f67 Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Wed, 9 May 2018 13:06:28 -0500 Subject: Use shared callMethod function in control manager To better handle exit/restart of the fan control application use the shared callMethod function to call systemd's startunit on the fan control ready target. This allows the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: StartUnit on fan control ready target works the same Change-Id: Idce2d8831b4e8de0ef181a0849587e465419f68c Signed-off-by: Matthew Barth --- control/manager.cpp | 28 ++++++++-------------------- control/manager.hpp | 5 ----- 2 files changed, 8 insertions(+), 25 deletions(-) (limited to 'control') diff --git a/control/manager.cpp b/control/manager.cpp index a322c10..1078473 100644 --- a/control/manager.cpp +++ b/control/manager.cpp @@ -122,26 +122,14 @@ void Manager::doInit() delay = sleep(delay); } - startFanControlReadyTarget(); -} - - -void Manager::startFanControlReadyTarget() -{ - auto method = _bus.new_method_call(SYSTEMD_SERVICE, - SYSTEMD_OBJ_PATH, - SYSTEMD_INTERFACE, - "StartUnit"); - - method.append(FAN_CONTROL_READY_TARGET); - method.append("replace"); - - auto response = _bus.call(method); - if (response.is_method_error()) - { - log("Failed to start fan control ready target"); - elog(); - } + util::SDBusPlus::callMethod( + _bus, + SYSTEMD_SERVICE, + SYSTEMD_OBJ_PATH, + SYSTEMD_INTERFACE, + "StartUnit", + FAN_CONTROL_READY_TARGET, + "replace"); } } // namespace control diff --git a/control/manager.hpp b/control/manager.hpp index d5b75fc..d049323 100644 --- a/control/manager.hpp +++ b/control/manager.hpp @@ -52,11 +52,6 @@ class Manager private: - /** - * Starts the obmc-fan-control-ready dbus target - */ - void startFanControlReadyTarget(); - /** * The dbus object */ -- cgit v1.2.1