Assign ASCII-Latin8 to dbus-sdr FRU string Type/Len
The FRU ID string Type/Len encoding in the dbus-sdr code is left
unassigned, which causes it to be tagged as unicode characters. This
is not the encoding of the data, which is actually ASCII/Latin8.
The problem appears to go unnoticed, I expect, because the dbus-sdr
functionality is not enabled. When dbus-sdr is enabled the id-string
supplied to IPMITool is ASCII/Latin8, but IPMITool decodes it as
unicode.
Tested:
Enabled dbus-sdr features.
Use 'ipmitool fru print'
Confirm FRU id-strings print as ASCII/Latin8
Change-Id: Ie6d936f6b5a0b0cd9ccd9adb68e46e1efbb9b2e5
Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index b61e13f..c77189a 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -96,6 +96,7 @@
static std::vector<uint8_t> fruCache;
static constexpr uint16_t invalidBus = 0xFFFF;
static constexpr uint8_t invalidAddr = 0xFF;
+static constexpr uint8_t typeASCIILatin8 = 0xC0;
static uint16_t cacheBus = invalidBus;
static uint8_t cacheAddr = invalidAddr;
static uint8_t lastDevId = 0xFF;
@@ -733,7 +734,7 @@
resp.body.entityInstance = entityInstance;
resp.body.oem = 0x0;
- resp.body.deviceIDLen = name.size();
+ resp.body.deviceIDLen = ipmi::storage::typeASCIILatin8 | name.size();
name.copy(resp.body.deviceID, name.size());
return IPMI_CC_OK;