Specify "8-bit ASCII + Latin 1" SDR encoding

Applications using OpenSolaris libipmi can't handle "Unicode" (type 0)
encoding for the sensor names [0].

This results in issues with VMWare ESXi which uses IPMI to fetch sensor
data from the BMC, all the names are shown as "Unspecified 1" (if
default EntityId is used), so status page, SEL entries and the logs
become very confusing.

Fix this by telling it to process all bytes as is by using "8-bit ASCII
+ Latin 1" type.

The patch is untested however similar changes to intel-ipmi-oem were
tried with VMWare ESXi 7.0 Update 2 and regular ipmitool (using GNU
FreeIPMI), both show names correctly.

[0] https://github.com/kofemann/opensolaris/blob/master/usr/src/lib/libipmi/common/ipmi_util.c#L258

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Idf19833e4877af1acb32f016e85e93c6f58df27e
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 5477d34..9ccf7e7 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -1724,7 +1724,8 @@
 
     // populate sensor name from path
     auto name = sensor::parseSdrIdFromPath(path);
-    record.body.id_string_info = name.size();
+    get_sdr::body::set_id_strlen(name.size(), &record.body);
+    get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
     std::strncpy(record.body.id_string, name.c_str(),
                  sizeof(record.body.id_string));
 
@@ -1846,6 +1847,7 @@
     {
         get_sdr::body::set_id_strlen(id_string.length(), &(record.body));
     }
+    get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
     std::strncpy(record.body.id_string, id_string.c_str(),
                  get_sdr::body::get_id_strlen(&(record.body)));
 }
@@ -1911,7 +1913,8 @@
     // populate sensor name from path
     auto name = sensor::parseSdrIdFromPath(path);
     int nameSize = std::min(name.size(), sizeof(record.body.id_string));
-    record.body.id_string_info = nameSize;
+    get_sdr::body::set_id_strlen(nameSize, &record.body);
+    get_sdr::body::set_id_type(3, &record.body); // "8-bit ASCII + Latin 1"
     std::memset(record.body.id_string, 0x00, sizeof(record.body.id_string));
     std::memcpy(record.body.id_string, name.c_str(), nameSize);
 
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index e04319c..8acabdf 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -1099,8 +1099,6 @@
         get_sdr::body::set_m(info->coefficientM, body);
         get_sdr::body::set_b_exp(info->exponentB, body);
         get_sdr::body::set_r_exp(info->exponentR, body);
-
-        get_sdr::body::set_id_type(0b00, body); // 00 = unicode
     }
 
     /* ID string */
@@ -1119,6 +1117,7 @@
     {
         get_sdr::body::set_id_strlen(id_string.length(), body);
     }
+    get_sdr::body::set_id_type(3, body); // "8-bit ASCII + Latin 1"
     strncpy(body->id_string, id_string.c_str(),
             get_sdr::body::get_id_strlen(body));