Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 1 | #include "fw_update_watch.hpp" |
| 2 | |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 3 | #include <phosphor-logging/elog-errors.hpp> |
| 4 | #include <sdeventplus/event.hpp> |
| 5 | |
Jayanth Othayoth | e0dd7af | 2023-09-13 09:03:30 +0000 | [diff] [blame] | 6 | #include <format> |
| 7 | |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 8 | int 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 Williams | 1a9a5a6 | 2021-10-06 13:05:06 -0500 | [diff] [blame] | 26 | catch (const std::exception& e) |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 27 | { |
| 28 | using namespace phosphor::logging; |
| 29 | log<level::ERR>( |
Jayanth Othayoth | e0dd7af | 2023-09-13 09:03:30 +0000 | [diff] [blame] | 30 | std::format("Exception reported: [{}]", e.what()).c_str()); |
Jayanth Othayoth | 13c57ad | 2021-07-16 06:02:21 -0500 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | return eventRet; |
| 34 | } |