Fix getManagedObjects on ObjectManager returning no objects
Currently, when calling getManagedObjects
```
busctl call xyz.openbmc_project.Time.Manager \
/xyz/openbmc_project/time/bmc \
org.freedesktop.DBus.ObjectManager \
GetManagedObjects
```
we end up getting no objects `a{oa{sa{sv}}} 0`. This is incorrect
and we technically should return the managed objects.
Looking further at the spec:
```
All returned object paths are children of the object path implementing
this interface, i.e. their object paths start with the ObjectManager's
object path plus '/'.
```
This implies that the the path owned by the object manager should
not be the bmc sub-entries but `/xyz/openbmc_project/time`
Change-Id: I3f2ee23ecfe745eb2e4e177e044645acc2015d88
Signed-off-by: Amithash Prasasd <amithash@meta.com>
diff --git a/main.cpp b/main.cpp
index a773304..a865035 100644
--- a/main.cpp
+++ b/main.cpp
@@ -22,7 +22,7 @@
bus.attach_event(sdEvent.get(), SD_EVENT_PRIORITY_NORMAL);
// Add sdbusplus ObjectManager
- sdbusplus::server::manager_t bmcEpochObjManager(bus, objpathBmc);
+ sdbusplus::server::manager_t bmcEpochObjManager(bus, objmgrpath);
phosphor::time::Manager manager(bus);
phosphor::time::BmcEpoch bmc(bus, objpathBmc, manager);
diff --git a/types.hpp b/types.hpp
index 7871a5d..b7a47ae 100644
--- a/types.hpp
+++ b/types.hpp
@@ -2,6 +2,7 @@
#include <xyz/openbmc_project/Time/Synchronization/server.hpp>
+static constexpr auto objmgrpath = "/xyz/openbmc_project/time";
static constexpr auto objpathBmc = "/xyz/openbmc_project/time/bmc";
static constexpr auto busname = "xyz.openbmc_project.Time.Manager";