#include "Inventory.hpp" #include "Utils.hpp" #include #include #include #include #include #include #include constexpr const char* inventoryPrefix = "/xyz/openbmc_project/inventory/"; constexpr const char* acceleratorIfaceName = "xyz.openbmc_project.Inventory.Item.Accelerator"; Inventory::Inventory( const std::shared_ptr& /*conn*/, sdbusplus::asio::object_server& objectServer, const std::string& inventoryName, const gpu::DeviceIdentification deviceType) : name(escapeName(inventoryName)) { if (deviceType == gpu::DeviceIdentification::DEVICE_GPU) { std::string path = inventoryPrefix + name; try { acceleratorInterface = objectServer.add_interface(path, acceleratorIfaceName); acceleratorInterface->register_property("Type", std::string("GPU")); acceleratorInterface->initialize(); } catch (const std::exception& e) { lg2::error( "Failed to add accelerator interface. path='{PATH}', error='{ERROR}'", "PATH", path, "ERROR", e.what()); } } }