Call softoff dbus interface directly

The host response can be extremely fast when requesting
a soft power off.  So fast in fact, that it may respond
before the obmc mapper has registered the softoff dbus
object and interface.  When this happens, ipmid does not
see softoff running so it goes down a different (and
incorrect) shutdown path.

This code change has the host response go directly to
the softoff dbus interface (instead of using mapper).
Once mapper is refactored in openbmc/openbmc#1661, this
software can go back to using it.

Resolves openbmc/openbmc#1743

Change-Id: I08df84783adef80c4eb91277d8d7aa6dc264730d
Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
diff --git a/chassishandler.cpp b/chassishandler.cpp
index 5dc23b2..6c23350 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -825,22 +825,28 @@
     constexpr auto property         = "ResponseReceived";
     constexpr auto value            = "xyz.openbmc_project.Ipmi.Internal."
             "SoftPowerOff.HostResponse.HostShutdown";
-    char *busname = nullptr;
 
     // Get the system bus where most system services are provided.
     auto bus = ipmid_get_sd_bus_connection();
 
     // Get the service name
-    auto r = mapper_get_service(bus, SOFTOFF_OBJPATH, &busname);
-    if (r < 0)
-    {
-        fprintf(stderr, "Failed to get %s bus name: %s\n",
-                SOFTOFF_OBJPATH, strerror(-r));
-        return r;
-    }
+    // TODO openbmc/openbmc#1661 - Mapper refactor
+    //
+    // See openbmc/openbmc#1743 for some details but high level summary is that
+    // for now the code will directly call the soft off interface due to a
+    // race condition with mapper usage
+    //
+    //char *busname = nullptr;
+    //auto r = mapper_get_service(bus, SOFTOFF_OBJPATH, &busname);
+    //if (r < 0)
+    //{
+    //    fprintf(stderr, "Failed to get %s bus name: %s\n",
+    //            SOFTOFF_OBJPATH, strerror(-r));
+    //    return r;
+    //}
 
     // No error object or reply expected.
-    int rc = sd_bus_call_method(bus, busname, SOFTOFF_OBJPATH, iface,
+    int rc = sd_bus_call_method(bus, SOFTOFF_BUSNAME, SOFTOFF_OBJPATH, iface,
                                 "Set", nullptr, nullptr, "ssv",
                                 soft_off_iface, property, "s", value);
     if (rc < 0)
@@ -849,7 +855,8 @@
                 strerror(-rc));
     }
 
-    free(busname);
+    //TODO openbmc/openbmc#1661 - Mapper refactor
+    //free(busname);
     return rc;
 }