ipmi: enable oem ipmi command for fan control

This enables building the OEM IPMI handler for fan control.  This
includes the ability to set it in manual mode, or check if it's in
fail-sade mode.

Tested: Verified that using host-side tool I was able to get and set the
mode for a zone, as well as check if a zone had fallen into failsade
mode.
Change-Id: I995407c089610692c7f6442f6e22f76689f4da1c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/Makefile.am b/Makefile.am
index 36eeb80..a46ffd0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,16 +66,16 @@
 	experiments/drive.cpp \
 	$(BUILT_SOURCES)
 
-#libmanualcmdsdir = ${libdir}/ipmid-providers
-#libmanualcmds_LTLIBRARIES = libmanualcmds.la
-#libmanualcmds_la_SOURCES = \
-#	ipmi/manualcmds.cpp
-#libmanualcmds_la_LDFLAGS = $(SYSTEMD_LIBS) \
-#                            $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
-#                            $(PHOSPHOR_LOGGING_LIBS) \
-#                            -version-info 0:0:0 -shared
-#libmanualcmds_la_CXXFLAGS = $(SYSTEMD_CFLAGS) \
-#                             $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
-#                             $(PHOSPHOR_LOGGING_CFLAGS)
+libmanualcmdsdir = ${libdir}/ipmid-providers
+libmanualcmds_LTLIBRARIES = libmanualcmds.la
+libmanualcmds_la_SOURCES = \
+	ipmi/manualcmds.cpp
+libmanualcmds_la_LDFLAGS = $(SYSTEMD_LIBS) \
+                            $(PHOSPHOR_DBUS_INTERFACES_LIBS) \
+                            $(PHOSPHOR_LOGGING_LIBS) \
+                            -version-info 0:0:0 -shared
+libmanualcmds_la_CXXFLAGS = $(SYSTEMD_CFLAGS) \
+                             $(PHOSPHOR_DBUS_INTERFACES_CFLAGS) \
+                             $(PHOSPHOR_LOGGING_CFLAGS)
 
 SUBDIRS = . test
diff --git a/configure.ac b/configure.ac
index ca26b79..267cb5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@
 PKG_CHECK_MODULES([SDBUSPLUS], [sdbusplus], ,[AC_MSG_ERROR([The openbmc/sdbusplus package is required])])
 PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging], ,[AC_MSG_ERROR([The openbmc/phosphor-logging package is required])])
 PKG_CHECK_MODULES([PHOSPHOR_DBUS_INTERFACES], [phosphor-dbus-interfaces], [], [AC_MSG_ERROR(["phosphor-dbus-interfaces required and not found."])])
+AC_CHECK_HEADER([host-ipmid], [AC_MSG_ERROR(["phosphor-host-ipmid required and not found."])])
 AC_CHECK_HEADER(experimental/any, ,[AC_MSG_ERROR([Could not find experimental/any...libstdc++fs development package required])])
 PKG_CHECK_MODULES([LIBCONFIGXX], [libconfig++ >= 1.5], ,AC_MSG_ERROR([libconfig++ 1.5 or newer not found.]))
 AX_PTHREAD([], [AC_MSG_ERROR(["pthread required and not found"])])
diff --git a/ipmi/manualcmds.cpp b/ipmi/manualcmds.cpp
index d71eedb..f86db9e 100644
--- a/ipmi/manualcmds.cpp
+++ b/ipmi/manualcmds.cpp
@@ -242,15 +242,15 @@
 
 void setupGlobalOemFanControl()
 {
-    ipmid::OemRouter* oemRouter = ipmid::mutableOemRouter();
+    oem::Router* router = oem::mutableRouter();
 
     fprintf(stderr,
             "Registering OEM:[%#08X], Cmd:[%#04X] for Manual Zone Control\n",
-            ipmid::oem::openbmc::obmcOemNumber,
-            ipmid::oem::openbmc::OemCmd::fanManualCmd);
+            oem::obmcOemNumber,
+            oem::Cmd::fanManualCmd);
 
-    oemRouter->registerHandler(
-        ipmid::oem::openbmc::obmcOemNumber,
-        ipmid::oem::openbmc::OemCmd::fanManualCmd,
+    router->registerHandler(
+        oem::obmcOemNumber,
+        oem::Cmd::fanManualCmd,
         ManualModeControl);
 }