selcommands: send sel entry on dbus
Send sel entry on dbus via logging service. Redfish api will get entries from dbus.
Expected event entry:
{
"@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/63",
"@odata.type": "#LogEntry.v1_9_0.LogEntry",
"AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/63/attachment",
"Created": "2018-03-14T11:34:35.178+00:00",
"EntryType": "Event",
"Id": "63",
"Message": SEL Entry Added: SEL Entry: FRU: 1, Record: Standard (0x02), Time: Fri Feb 18 16:06:25 1972\n, Sensor: THERM_THRESH_EVT (0x7D), Event Data: (010000) Limit Exceeded Assertion
"Modified": "2018-03-14T11:34:35.178+00:00",
"Name": "System Event Log Entry",
"Resolved": false,
"Severity": "OK"
}
Tested: Tested and verified on greatlakes platform.
Change-Id: Ic9584474f9bf3619f0eed95f7d19039850899c07
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
diff --git a/src/selcommands.cpp b/src/selcommands.cpp
index c6f0c9b..3572269 100644
--- a/src/selcommands.cpp
+++ b/src/selcommands.cpp
@@ -1407,6 +1407,25 @@
phosphor::logging::entry("IPMISEL_MESSAGE_ID=%s", messageID.c_str()),
phosphor::logging::entry("IPMISEL_MESSAGE_ARGS=%s", logErr.c_str()));
+ std::map<std::string, std::string> ad;
+ std::string severity = "xyz.openbmc_project.Logging.Entry.Level.Critical";
+ ad.emplace("IPMI_RAW", ipmiRaw);
+
+ auto bus = sdbusplus::bus::new_default();
+ auto reqMsg = bus.new_method_call(
+ "xyz.openbmc_project.Logging", "/xyz/openbmc_project/logging",
+ "xyz.openbmc_project.Logging.Create", "Create");
+ reqMsg.append(logErr, severity, ad);
+
+ try
+ {
+ bus.call(reqMsg);
+ }
+ catch (sdbusplus::exception_t& e)
+ {
+ phosphor::logging::log<phosphor::logging::level::ERR>(e.what());
+ }
+
int responseID = selObj.addEntry(ipmiRaw.c_str());
if (responseID < 0)
{
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 33584c4..ec52543 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -967,7 +967,7 @@
std::string partName = "PartNumber";
std::string verDel = "VERSION=";
std::string verPath = "/etc/os-release";
- size_t hostPosition;
+ size_t hostPosition = 0;
size_t maxPosition;
if (page == 1)