usb: Update the RequestedActivation property

Subscribe to the add software interface, when an update is detected,
call back the updateActivation method and verify whether it needs
to be updated. If necessary:
1. Set ApplyTime to OnReset to prevent the bmc from restarting
   immediately after the update.
2. Change the RequestedActivation attribute value and start to update
   the image bmc.

Tested: Manually start the phopshor-usb-manager daemon, and saw that
the bmc upgrade file(*.tar) has been copied to /tmp/images and
the update has been triggered, and bmc has not been restarted
immediately.

Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ic650e34f8ec61d3c826332d28275db90f9ef348e
diff --git a/usb/usb_manager_main.cpp b/usb/usb_manager_main.cpp
index 143125d..1f3ac81 100644
--- a/usb/usb_manager_main.cpp
+++ b/usb/usb_manager_main.cpp
@@ -2,10 +2,16 @@
 
 #include <CLI/CLI.hpp>
 #include <phosphor-logging/lg2.hpp>
+#include <sdeventplus/event.hpp>
 
 int main(int argc, char** argv)
 {
     namespace fs = std::filesystem;
+    // Dbus constructs
+    auto bus = sdbusplus::bus::new_default();
+
+    // Get a default event loop
+    auto event = sdeventplus::Event::get_default();
 
     std::string fileName{};
 
@@ -22,14 +28,11 @@
     }
 
     fs::path usbPath = fs::path{"/run/media/usb"} / fileName;
-    phosphor::usb::USBManager manager(usbPath);
+    phosphor::usb::USBManager manager(bus, event, usbPath);
 
-    if (!manager.run())
-    {
-        lg2::error("Failed to FW Update via USB, usbPath:{USBPATH}", "USBPATH",
-                   usbPath);
-        return -1;
-    }
+    // Attach the bus to sd_event to service user requests
+    bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
+    event.loop();
 
     return 0;
 }