Revert "drop sdevents hack"

This reverts commit d2dd5bc2eddc73504734112c0d6f745202b1b3a0.

The commit was inadvertently merged upstream.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Icf03e2ca476271b4606500846593e36fe326f3c5
diff --git a/include/ipmid/api.h b/include/ipmid/api.h
index e8d8cfd..188db4a 100644
--- a/include/ipmid/api.h
+++ b/include/ipmid/api.h
@@ -151,6 +151,7 @@
 EInterfaceIndex getInterfaceIndex(void);
 
 sd_bus* ipmid_get_sd_bus_connection(void);
+sd_event* ipmid_get_sd_event_connection(void);
 sd_bus_slot* ipmid_get_sd_bus_slot(void);
 
 // move this from ipmid.hpp, which is now gone
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index 30432d9..1bb8934 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -31,6 +31,7 @@
 #include <phosphor-logging/lg2.hpp>
 #include <sdbusplus/asio/connection.hpp>
 #include <sdbusplus/asio/object_server.hpp>
+#include <sdbusplus/asio/sd_event.hpp>
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/bus/match.hpp>
 #include <sdbusplus/timer.hpp>
@@ -84,6 +85,11 @@
 }
 
 sd_bus* bus;
+sd_event* events = nullptr;
+sd_event* ipmid_get_sd_event_connection(void)
+{
+    return events;
+}
 sd_bus* ipmid_get_sd_bus_connection(void)
 {
     return bus;
@@ -834,6 +840,15 @@
     auto sdbusp = std::make_shared<sdbusplus::asio::connection>(*io, bus);
     setSdBus(sdbusp);
 
+    // TODO: Hack to keep the sdEvents running.... Not sure why the sd_event
+    //       queue stops running if we don't have a timer that keeps re-arming
+    sdbusplus::Timer t2([]() { ; });
+    t2.start(std::chrono::microseconds(500000), true);
+
+    // TODO: Remove all vestiges of sd_event from phosphor-host-ipmid
+    //       until that is done, add the sd_event wrapper to the io object
+    sdbusplus::asio::sd_event_wrapper sdEvents(*io);
+
     cmdManager = std::make_unique<phosphor::host::command::Manager>(*sdbusp);
 
     // Register all command providers and filters