blob: afa6e6a0f10311c4d2067ff7142826d6671e6e67 [file] [log] [blame]
Jayanth Othayoth13c57ad2021-07-16 06:02:21 -05001#include "fw_update_watch.hpp"
2
Jayanth Othayoth13c57ad2021-07-16 06:02:21 -05003#include <phosphor-logging/elog-errors.hpp>
4#include <sdeventplus/event.hpp>
5
Jayanth Othayothe0dd7af2023-09-13 09:03:30 +00006#include <format>
7
Jayanth Othayoth13c57ad2021-07-16 06:02:21 -05008int main()
9{
10 auto eventRet = 0;
11
12 try
13 {
14 auto bus = sdbusplus::bus::new_default();
15
16 auto event = sdeventplus::Event::get_default();
17
18 // create watch for interface added in software update.
19 openpower::phal::fwupdate::Watch eWatch(bus);
20
21 bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
22
23 // Watch for software update
24 eventRet = event.loop();
25 }
Patrick Williams1a9a5a62021-10-06 13:05:06 -050026 catch (const std::exception& e)
Jayanth Othayoth13c57ad2021-07-16 06:02:21 -050027 {
28 using namespace phosphor::logging;
29 log<level::ERR>(
Jayanth Othayothe0dd7af2023-09-13 09:03:30 +000030 std::format("Exception reported: [{}]", e.what()).c_str());
Jayanth Othayoth13c57ad2021-07-16 06:02:21 -050031 }
32
33 return eventRet;
34}