blob: b991b6e83d21bbd094812f40482521d1e1d0796f [file] [log] [blame]
Ben Tyner9ae5ca42020-02-28 13:13:50 -06001#include <logging.hpp>
2#include <sdbusplus/bus.hpp>
3
Ben Tyner9ae5ca42020-02-28 13:13:50 -06004namespace attn
5{
6
7/** @brief Start host diagnostic mode systemd unit */
8void tiHandler()
9{
10 // trace message
Ben Tyner9dbab8b2020-03-31 08:55:23 -050011 log<level::INFO>("start host diagnostic mode service");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060012
13 // Use the systemd service manager object interface to call the start unit
14 // method with the obmc-host-diagnostic-mode target.
15 auto bus = sdbusplus::bus::new_system();
16 auto method = bus.new_method_call(
17 "org.freedesktop.systemd1", "/org/freedesktop/systemd1",
18 "org.freedesktop.systemd1.Manager", "StartUnit");
19
20 method.append("obmc-host-diagnostic-mode@0.target"); // unit to activate
21 method.append("replace"); // mode = replace conflicting queued jobs
22 bus.call_noreply(method); // start the service
23
24 return;
25}
26
27} // namespace attn