Add sel entry
Add sel entry for ipmi raw command
Tested:`ipmitool raw 0x0a 0x44 0x00 0x01 0x02 0x00 0x00 0x00
0x00 0x20 0x00 0x04 0x14 0x8a 0x6f 0x00 0x00 0x00` for power_button
pressed,`ipmitool sel list` can see
1 | 01/24/21 | 02:02:06 UTC | Button #0x8a | Power Button pressed | Asserted
Signed-off-by: Lotus Xu <xuxiaohan@bytedance.com>
Change-Id: I5a6bff109e5d12707a3a74570e6b7a584c7117bf
diff --git a/selutility.hpp b/selutility.hpp
index 06fc453..91c4eaf 100644
--- a/selutility.hpp
+++ b/selutility.hpp
@@ -2,8 +2,11 @@
#include <chrono>
#include <cstdint>
+#include <iomanip>
+#include <iostream>
#include <ipmid/types.hpp>
#include <sdbusplus/server.hpp>
+#include <sstream>
namespace ipmi
{
@@ -167,6 +170,17 @@
*/
void readLoggingObjectPaths(ObjectPaths& paths);
+template <typename T>
+std::string toHexStr(const T& data)
+{
+ std::stringstream stream;
+ stream << std::hex << std::uppercase << std::setfill('0');
+ for (const auto& v : data)
+ {
+ stream << std::setw(2) << static_cast<int>(v);
+ }
+ return stream.str();
+}
namespace internal
{