summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac1
-rw-r--r--storageaddsel.cpp23
3 files changed, 27 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 95faaf1..45860de 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -32,8 +32,8 @@ libapphandler_la_SOURCES = \
transporthandler.cpp \
globalhandler.cpp \
groupext.cpp
-libapphandler_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) -version-info 0:0:0 -shared
-libapphandler_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS)
+libapphandler_la_LDFLAGS = $(SYSTEMD_LIBS) $(libmapper_LIBS) $(PHOSPHOR_LOGGING_LIBS) -version-info 0:0:0 -shared
+libapphandler_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS) $(PHOSPHOR_LOGGING_CFLAGS)
libsysintfcmdsdir = ${libdir}/ipmid-providers
libsysintfcmds_LTLIBRARIES = libsysintfcmds.la
@@ -52,4 +52,4 @@ libhostservice_la_CXXFLAGS = $(SYSTEMD_CFLAGS) $(libmapper_CFLAGS)
nobase_include_HEADERS = \
host-ipmid/ipmid-api.h
-SUBDIRS = test \ No newline at end of file
+SUBDIRS = test
diff --git a/configure.ac b/configure.ac
index 5dc3e7f..daba2c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,6 +15,7 @@ AC_PROG_MAKE_SET
# Checks for libraries.
AC_CHECK_LIB([mapper], [mapper_get_service], ,[AC_MSG_ERROR([Could not find libmapper...openbmc/phosphor-objmgr package required])])
PKG_CHECK_MODULES([SYSTEMD], [libsystemd >= 221])
+PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging],, [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
# Checks for header files.
AC_CHECK_HEADER(systemd/sd-bus.h, ,[AC_MSG_ERROR([Could not find systemd/sd-bus.h...systemd developement package required])])
diff --git a/storageaddsel.cpp b/storageaddsel.cpp
index 84e3092..0b40d47 100644
--- a/storageaddsel.cpp
+++ b/storageaddsel.cpp
@@ -8,12 +8,15 @@
#include <memory>
#include <systemd/sd-bus.h>
#include <mapper.h>
+#include <elog.hpp>
+#include <elog-errors-HostEvent.hpp>
#include "host-ipmid/ipmid-api.h"
#include "sensorhandler.h"
#include "storagehandler.h"
using namespace std;
+using namespace phosphor::logging;
//////////////////////////
struct esel_section_headers_t {
@@ -185,6 +188,26 @@ int send_esel_to_dbus(const char *desc, const char *sev, const char *details, ui
const char *object_name = "/org/openbmc/records/events";
char *bus_name = NULL;
+ // Allocate enough space to represent the data in hex separated by spaces,
+ // to mimic how IPMI would display the data.
+ unique_ptr<char[]> selData(new char[debuglen*3]());
+ uint32_t i = 0;
+ for(i = 0; i < debuglen; i++)
+ {
+ sprintf(&selData[i*3], "%02x ", 0xFF & ((char*)debug)[i]);
+ }
+ log<level::INFO>("Received Host Event", entry("ESEL=%s", selData.get()));
+
+ try
+ {
+ elog<org::open_power::Error::Host::Event>(
+ prev_entry<org::open_power::Error::Host::Event::ESEL>());
+ }
+ catch (elogException<org::open_power::Error::Host::Event>& e)
+ {
+ commit(e.name());
+ }
+
mbus = ipmid_get_sd_bus_connection();
r = mapper_get_service(mbus, object_name, &bus_name);
if (r < 0) {
OpenPOWER on IntegriCloud