blob: deb5eeef7f6a66963eda341129b4b6db512fa791 [file] [log] [blame]
Lei YU5e0dcb32019-08-02 18:04:34 +08001#include "config.h"
2
3#include "utils.hpp"
4
5#include <fstream>
6
7namespace utils
8{
9
10namespace // anonymous
11{
12constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
13constexpr auto MAPPER_PATH = "/xyz/openbmc_project/object_mapper";
14constexpr auto MAPPER_INTERFACE = "xyz.openbmc_project.ObjectMapper";
15} // namespace
16
17std::vector<std::string> getPSUInventoryPath(sdbusplus::bus::bus& bus)
18{
19 std::vector<std::string> paths;
20 auto method = bus.new_method_call(MAPPER_BUSNAME, MAPPER_PATH,
21 MAPPER_INTERFACE, "GetSubTreePaths");
22 method.append(PSU_INVENTORY_PATH_BASE);
23 method.append(0); // Depth 0 to search all
24 method.append(std::vector<std::string>({PSU_INVENTORY_IFACE}));
25 auto reply = bus.call(method);
26
27 reply.read(paths);
28 return paths;
29}
30
31} // namespace utils