From 2efb3e7784c52d199fc21d9fcfaf709423800c75 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 6 Feb 2017 21:43:59 -0600 Subject: Create a SEL error log Log the SEL data to the journal and call the commit interface to write the error log with the data. Change-Id: Ifcb842e37f2fdb14f80ab24651d565da05da47bf Signed-off-by: Adriana Kobylak --- storageaddsel.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'storageaddsel.cpp') diff --git a/storageaddsel.cpp b/storageaddsel.cpp index 84e3092..0b40d47 100644 --- a/storageaddsel.cpp +++ b/storageaddsel.cpp @@ -8,12 +8,15 @@ #include #include #include +#include +#include #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 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("Received Host Event", entry("ESEL=%s", selData.get())); + + try + { + elog( + prev_entry()); + } + catch (elogException& e) + { + commit(e.name()); + } + mbus = ipmid_get_sd_bus_connection(); r = mapper_get_service(mbus, object_name, &bus_name); if (r < 0) { -- cgit v1.2.1