dbus-sdr: VR Event Status: Fix mode proprety fetch
The dbus call to fetch the mode proprty was not working due to the
variant return type. Fix it by just targeting string.
Before:
```
ipmitool raw 0x4 0x2b 0xd8
Unable to send RAW command (channel=0x0 netfn=0x4 lun=0x0 cmd=0x2b rsp=0xce): Command response could not be provided
```
Tested:
Working call.
```
ipmitool raw 0x4 0x2b 0xd8
00 04 00 00 00
```
Change-Id: Ie07deeac676011fa6f0aff190d4ea1d13118c218
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 601fea6..8f177e6 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -474,10 +474,10 @@
{
return false;
}
- ipmi::Value modeVariant;
+ std::string mode;
auto ec = getDbusProperty(ctx, connection, path, sensor::vrInterface,
- "Selected", modeVariant);
+ "Selected", mode);
if (ec)
{
log<level::ERR>("Failed to get property",
@@ -488,17 +488,7 @@
return false;
}
- auto mode = std::get_if<std::string>(&modeVariant);
- if (mode == nullptr)
- {
- log<level::ERR>("property is not a string",
- entry("PROPERTY=%s", "Selected"),
- entry("PATH=%s", path.c_str()),
- entry("INTERFACE=%s", sensor::sensorInterface));
- return false;
- }
-
- auto itr = std::find(profiles->begin(), profiles->end(), *mode);
+ auto itr = std::find(profiles->begin(), profiles->end(), mode);
if (itr == profiles->end())
{
using namespace phosphor::logging;
@@ -528,7 +518,7 @@
if constexpr (debug)
{
std::cerr << "VR sensor " << sensor::parseSdrIdFromPath(path)
- << " mode is: [" << index << "] " << *mode << std::endl;
+ << " mode is: [" << index << "] " << mode << std::endl;
}
return true;
}