manufacturingcmds: added intrusionsensor status
Modified appMTMGetSignal API to support intrusion sensor status.
Tested:
Tested intrusion sensor status with ipmitool raw command
Command: ipmitool raw 0x30 0x14 0x04 0x00 0x00
Response: 01 //hardware Intrusion
Signed-off-by: anil kumar appana <anil.kumarx.appana@intel.com>
Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I6a0cf6738dacbbaeece6a66d0264e870963bed5b
diff --git a/include/manufacturingcommands.hpp b/include/manufacturingcommands.hpp
index 9246de9..e7a1cc8 100644
--- a/include/manufacturingcommands.hpp
+++ b/include/manufacturingcommands.hpp
@@ -51,6 +51,13 @@
static constexpr const char* buttonIntf = "xyz.openbmc_project.Chassis.Buttons";
static constexpr const char* ledIntf = "xyz.openbmc_project.Led.Physical";
+static constexpr const char* intrusionService =
+ "xyz.openbmc_project.IntrusionSensor";
+static constexpr const char* intrusionPath =
+ "/xyz/openbmc_project/Intrusion/Chassis_Intrusion";
+static constexpr const char* intrusionIntf =
+ "xyz.openbmc_project.Chassis.Intrusion";
+
static constexpr const char* busPropertyIntf =
"org.freedesktop.DBus.Properties";
static constexpr const char* ledStateStr =
@@ -121,6 +128,17 @@
smSetSignalMax
};
+/** @enum IntrusionStatus
+.*
+ * Intrusion Status
+ */
+enum class IntrusionStatus : uint8_t
+{
+ normal = 0,
+ hardwareIntrusion,
+ tamperingDetected
+};
+
struct SetSmSignalReq
{
SmSignalSet Signal;
diff --git a/src/manufacturingcommands.cpp b/src/manufacturingcommands.cpp
index c96d9f4..d8b49dc 100644
--- a/src/manufacturingcommands.cpp
+++ b/src/manufacturingcommands.cpp
@@ -277,6 +277,41 @@
switch (signalType)
{
+ case SmSignalGet::smChassisIntrusion:
+ {
+ ipmi::Value reply;
+ if (mtm.getProperty(intrusionService, intrusionPath, intrusionIntf,
+ "Status", &reply) < 0)
+ {
+ return ipmi::responseInvalidFieldRequest();
+ }
+ std::string* intrusionStatus = std::get_if<std::string>(&reply);
+ if (!intrusionStatus)
+ {
+ return ipmi::responseUnspecifiedError();
+ }
+
+ uint8_t status = 0;
+ if (!intrusionStatus->compare("Normal"))
+ {
+ status = static_cast<uint8_t>(IntrusionStatus::normal);
+ }
+ else if (!intrusionStatus->compare("HardwareIntrusion"))
+ {
+ status =
+ static_cast<uint8_t>(IntrusionStatus::hardwareIntrusion);
+ }
+ else if (!intrusionStatus->compare("TamperingDetected"))
+ {
+ status =
+ static_cast<uint8_t>(IntrusionStatus::tamperingDetected);
+ }
+ else
+ {
+ return ipmi::responseUnspecifiedError();
+ }
+ return ipmi::responseSuccess(status, std::nullopt);
+ }
case SmSignalGet::smFanPwmGet:
{
ipmi::Value reply;