1a31ceb91SManojkiran Eda #include "collect_slot_vpd.hpp"
2a31ceb91SManojkiran Eda
3a31ceb91SManojkiran Eda #include "oem_ibm_handler.hpp"
4a31ceb91SManojkiran Eda
5a31ceb91SManojkiran Eda #include <phosphor-logging/lg2.hpp>
6a31ceb91SManojkiran Eda
7a31ceb91SManojkiran Eda PHOSPHOR_LOG2_USING;
8a31ceb91SManojkiran Eda
9a31ceb91SManojkiran Eda namespace pldm
10a31ceb91SManojkiran Eda {
11a31ceb91SManojkiran Eda namespace responder
12a31ceb91SManojkiran Eda {
13a31ceb91SManojkiran Eda using namespace oem_ibm_platform;
timeOutHandler()14a31ceb91SManojkiran Eda void SlotHandler::timeOutHandler()
15a31ceb91SManojkiran Eda {
16a31ceb91SManojkiran Eda info(
17a31ceb91SManojkiran Eda "Timer expired waiting for Event from Inventory on following pldm_entity: [ {ENTITY_TYP}, {ENTITY_NUM}, {ENTITY_ID} ]",
18a31ceb91SManojkiran Eda "ENTITY_TYP",
19a31ceb91SManojkiran Eda static_cast<unsigned>(currentOnGoingSlotEntity.entity_type),
20a31ceb91SManojkiran Eda "ENTITY_NUM",
21a31ceb91SManojkiran Eda static_cast<unsigned>(currentOnGoingSlotEntity.entity_instance_num),
22a31ceb91SManojkiran Eda "ENTITY_ID",
23a31ceb91SManojkiran Eda static_cast<unsigned>(currentOnGoingSlotEntity.entity_container_id));
24a31ceb91SManojkiran Eda // Disable the timer
25a31ceb91SManojkiran Eda timer.setEnabled(false);
26a31ceb91SManojkiran Eda
27a31ceb91SManojkiran Eda // obtain the sensor Id
28a31ceb91SManojkiran Eda auto sensorId = pldm::utils::findStateSensorId(
29a31ceb91SManojkiran Eda pdrRepo, 0, PLDM_ENTITY_SLOT,
30a31ceb91SManojkiran Eda currentOnGoingSlotEntity.entity_instance_num,
31a31ceb91SManojkiran Eda currentOnGoingSlotEntity.entity_container_id,
32a31ceb91SManojkiran Eda PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE);
33a31ceb91SManojkiran Eda
34a31ceb91SManojkiran Eda // send the sensor event to host with error state
35a31ceb91SManojkiran Eda sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
36a31ceb91SManojkiran Eda PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_ERROR,
37a31ceb91SManojkiran Eda PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN);
38a31ceb91SManojkiran Eda }
39a31ceb91SManojkiran Eda
enableSlot(uint16_t effecterId,const AssociatedEntityMap & fruAssociationMap,uint8_t stateFileValue)40a31ceb91SManojkiran Eda void SlotHandler::enableSlot(uint16_t effecterId,
41a31ceb91SManojkiran Eda const AssociatedEntityMap& fruAssociationMap,
42a31ceb91SManojkiran Eda uint8_t stateFileValue)
43a31ceb91SManojkiran Eda
44a31ceb91SManojkiran Eda {
45a31ceb91SManojkiran Eda info("CM: slot enable effecter id: {EFFECTER_ID}", "EFFECTER_ID",
46a31ceb91SManojkiran Eda effecterId);
47a31ceb91SManojkiran Eda const pldm_entity entity = getEntityIDfromEffecterID(effecterId);
48a31ceb91SManojkiran Eda
49a31ceb91SManojkiran Eda for (const auto& [key, value] : fruAssociationMap)
50a31ceb91SManojkiran Eda {
51a31ceb91SManojkiran Eda if (entity.entity_instance_num == value.entity_instance_num &&
52a31ceb91SManojkiran Eda entity.entity_type == value.entity_type &&
53a31ceb91SManojkiran Eda entity.entity_container_id == value.entity_container_id)
54a31ceb91SManojkiran Eda {
55a31ceb91SManojkiran Eda this->currentOnGoingSlotEntity.entity_type = value.entity_type;
56a31ceb91SManojkiran Eda this->currentOnGoingSlotEntity.entity_instance_num =
57a31ceb91SManojkiran Eda value.entity_instance_num;
58a31ceb91SManojkiran Eda this->currentOnGoingSlotEntity.entity_container_id =
59a31ceb91SManojkiran Eda value.entity_container_id;
60a31ceb91SManojkiran Eda processSlotOperations(key, value, stateFileValue);
61a31ceb91SManojkiran Eda }
62a31ceb91SManojkiran Eda }
63a31ceb91SManojkiran Eda }
64a31ceb91SManojkiran Eda
processSlotOperations(const std::string & slotObjectPath,const pldm_entity & entity,uint8_t stateFieldValue)65a31ceb91SManojkiran Eda void SlotHandler::processSlotOperations(const std::string& slotObjectPath,
66a31ceb91SManojkiran Eda const pldm_entity& entity,
67a31ceb91SManojkiran Eda uint8_t stateFieldValue)
68a31ceb91SManojkiran Eda {
69a31ceb91SManojkiran Eda info("CM: processing the slot operations, SlotObject: {SLOT_OBJ}",
70a31ceb91SManojkiran Eda "SLOT_OBJ", slotObjectPath);
71a31ceb91SManojkiran Eda
72a31ceb91SManojkiran Eda std::string adapterObjPath;
73a31ceb91SManojkiran Eda try
74a31ceb91SManojkiran Eda {
75a31ceb91SManojkiran Eda // get the adapter dbus object path from the slot dbus object path
76a31ceb91SManojkiran Eda adapterObjPath = getAdapterObjPath(slotObjectPath).value();
77a31ceb91SManojkiran Eda }
78a31ceb91SManojkiran Eda catch (const std::bad_optional_access& e)
79a31ceb91SManojkiran Eda {
80a31ceb91SManojkiran Eda error("Failed to get the adapter dbus object ERROR={ERROR}", "ERROR",
81a31ceb91SManojkiran Eda e);
82a31ceb91SManojkiran Eda return;
83a31ceb91SManojkiran Eda }
84a31ceb91SManojkiran Eda
85a31ceb91SManojkiran Eda info(
86a31ceb91SManojkiran Eda "CM: Found an adapter under the slot, adapter object:{ADAPTER_OBJ_PATH}",
87a31ceb91SManojkiran Eda "ADAPTER_OBJ_PATH", adapterObjPath);
88a31ceb91SManojkiran Eda // create a presence match for the adpter present property
89a31ceb91SManojkiran Eda createPresenceMatch(adapterObjPath, entity, stateFieldValue);
90a31ceb91SManojkiran Eda
91a31ceb91SManojkiran Eda // call the VPD Manager to collect/remove VPD objects
92a31ceb91SManojkiran Eda callVPDManager(adapterObjPath, stateFieldValue);
93a31ceb91SManojkiran Eda
94a31ceb91SManojkiran Eda // start the 1 min timer
95a31ceb91SManojkiran Eda timer.restart(std::chrono::seconds(60));
96a31ceb91SManojkiran Eda }
97a31ceb91SManojkiran Eda
callVPDManager(const std::string & adapterObjPath,uint8_t stateFieldValue)98a31ceb91SManojkiran Eda void SlotHandler::callVPDManager(const std::string& adapterObjPath,
99a31ceb91SManojkiran Eda uint8_t stateFieldValue)
100a31ceb91SManojkiran Eda {
101a31ceb91SManojkiran Eda static constexpr auto VPDObjPath = "/com/ibm/VPD/Manager";
102a31ceb91SManojkiran Eda static constexpr auto VPDInterface = "com.ibm.VPD.Manager";
103a31ceb91SManojkiran Eda auto& bus = pldm::utils::DBusHandler::getBus();
104a31ceb91SManojkiran Eda try
105a31ceb91SManojkiran Eda {
106a31ceb91SManojkiran Eda auto service =
107a31ceb91SManojkiran Eda pldm::utils::DBusHandler().getService(VPDObjPath, VPDInterface);
108a31ceb91SManojkiran Eda if (stateFieldValue == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_ADD)
109a31ceb91SManojkiran Eda {
110a31ceb91SManojkiran Eda auto method = bus.new_method_call(service.c_str(), VPDObjPath,
111a31ceb91SManojkiran Eda VPDInterface, "CollectFRUVPD");
112a31ceb91SManojkiran Eda method.append(
113a31ceb91SManojkiran Eda static_cast<sdbusplus::message::object_path>(adapterObjPath));
114a31ceb91SManojkiran Eda bus.call_noreply(method, dbusTimeout);
115a31ceb91SManojkiran Eda }
116a31ceb91SManojkiran Eda else if (stateFieldValue == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_REMOVE ||
117a31ceb91SManojkiran Eda stateFieldValue == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_REPLACE)
118a31ceb91SManojkiran Eda {
119a31ceb91SManojkiran Eda auto method = bus.new_method_call(service.c_str(), VPDObjPath,
120a31ceb91SManojkiran Eda VPDInterface, "deleteFRUVPD");
121a31ceb91SManojkiran Eda method.append(
122a31ceb91SManojkiran Eda static_cast<sdbusplus::message::object_path>(adapterObjPath));
123a31ceb91SManojkiran Eda bus.call_noreply(method, dbusTimeout);
124a31ceb91SManojkiran Eda }
125a31ceb91SManojkiran Eda }
126a31ceb91SManojkiran Eda catch (const std::exception& e)
127a31ceb91SManojkiran Eda {
128a31ceb91SManojkiran Eda error(
129a31ceb91SManojkiran Eda "failed to make a d-bus call to VPD Manager , Operation = {STATE_FILED_VAL}, ERROR={ERROR}",
130a31ceb91SManojkiran Eda "STATE_FILED_VAL", (unsigned)stateFieldValue, "ERROR", e);
131a31ceb91SManojkiran Eda }
132a31ceb91SManojkiran Eda }
133a31ceb91SManojkiran Eda
134a31ceb91SManojkiran Eda std::optional<std::string>
getAdapterObjPath(const std::string & slotObjPath)135a31ceb91SManojkiran Eda SlotHandler::getAdapterObjPath(const std::string& slotObjPath)
136a31ceb91SManojkiran Eda {
137a31ceb91SManojkiran Eda static constexpr auto searchpath = "/xyz/openbmc_project/inventory";
138a31ceb91SManojkiran Eda int depth = 0;
139a31ceb91SManojkiran Eda std::vector<std::string> pcieAdapterInterface = {
140a31ceb91SManojkiran Eda "xyz.openbmc_project.Inventory.Item.PCIeDevice"};
141a31ceb91SManojkiran Eda pldm::utils::GetSubTreeResponse response =
142a31ceb91SManojkiran Eda pldm::utils::DBusHandler().getSubtree(searchpath, depth,
143a31ceb91SManojkiran Eda pcieAdapterInterface);
144a31ceb91SManojkiran Eda for (const auto& [objPath, serviceMap] : response)
145a31ceb91SManojkiran Eda {
146a31ceb91SManojkiran Eda // An adapter is a child of a PCIe Slot Object
147a31ceb91SManojkiran Eda if (objPath.contains(slotObjPath))
148a31ceb91SManojkiran Eda {
149a31ceb91SManojkiran Eda // Found the Adapter under the slot
150a31ceb91SManojkiran Eda return objPath;
151a31ceb91SManojkiran Eda }
152a31ceb91SManojkiran Eda }
153a31ceb91SManojkiran Eda return std::nullopt;
154a31ceb91SManojkiran Eda }
155a31ceb91SManojkiran Eda
createPresenceMatch(const std::string & adapterObjectPath,const pldm_entity & entity,uint8_t stateFieldValue)156a31ceb91SManojkiran Eda void SlotHandler::createPresenceMatch(const std::string& adapterObjectPath,
157a31ceb91SManojkiran Eda const pldm_entity& entity,
158a31ceb91SManojkiran Eda uint8_t stateFieldValue)
159a31ceb91SManojkiran Eda {
160a31ceb91SManojkiran Eda fruPresenceMatch = std::make_unique<sdbusplus::bus::match_t>(
161a31ceb91SManojkiran Eda pldm::utils::DBusHandler::getBus(),
162a31ceb91SManojkiran Eda propertiesChanged(adapterObjectPath,
163a31ceb91SManojkiran Eda "xyz.openbmc_project.Inventory.Item"),
164a31ceb91SManojkiran Eda [this, adapterObjectPath, stateFieldValue,
165*a7b08dc6SPatrick Williams entity](sdbusplus::message_t& msg) {
166a31ceb91SManojkiran Eda pldm::utils::DbusChangedProps props{};
167a31ceb91SManojkiran Eda std::string intf;
168a31ceb91SManojkiran Eda msg.read(intf, props);
169a31ceb91SManojkiran Eda const auto itr = props.find("Present");
170a31ceb91SManojkiran Eda if (itr != props.end())
171a31ceb91SManojkiran Eda {
172a31ceb91SManojkiran Eda bool value = std::get<bool>(itr->second);
173a31ceb91SManojkiran Eda // Present Property is found
174a31ceb91SManojkiran Eda this->processPresentPropertyChange(value, stateFieldValue,
175a31ceb91SManojkiran Eda entity);
176a31ceb91SManojkiran Eda }
177a31ceb91SManojkiran Eda });
178a31ceb91SManojkiran Eda }
179a31ceb91SManojkiran Eda
processPresentPropertyChange(bool presentValue,uint8_t stateFiledvalue,const pldm_entity & entity)180a31ceb91SManojkiran Eda void SlotHandler::processPresentPropertyChange(
181a31ceb91SManojkiran Eda bool presentValue, uint8_t stateFiledvalue, const pldm_entity& entity)
182a31ceb91SManojkiran Eda {
183a31ceb91SManojkiran Eda // irrespective of true->false or false->true change, we should stop the
184a31ceb91SManojkiran Eda // timer
185a31ceb91SManojkiran Eda timer.setEnabled(false);
186a31ceb91SManojkiran Eda
187a31ceb91SManojkiran Eda // remove the prence match so that it does not monitor the change
188a31ceb91SManojkiran Eda // even after we captured the property changed signal
189a31ceb91SManojkiran Eda fruPresenceMatch = nullptr;
190a31ceb91SManojkiran Eda
191a31ceb91SManojkiran Eda // obtain the sensor id attached with this slot
192a31ceb91SManojkiran Eda auto sensorId = pldm::utils::findStateSensorId(
193a31ceb91SManojkiran Eda pdrRepo, 0, PLDM_ENTITY_SLOT, entity.entity_instance_num,
194a31ceb91SManojkiran Eda entity.entity_container_id, PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE);
195a31ceb91SManojkiran Eda
196a31ceb91SManojkiran Eda uint8_t sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN;
197a31ceb91SManojkiran Eda if (presentValue)
198a31ceb91SManojkiran Eda {
199a31ceb91SManojkiran Eda sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_ENABLED;
200a31ceb91SManojkiran Eda }
201a31ceb91SManojkiran Eda else
202a31ceb91SManojkiran Eda {
203a31ceb91SManojkiran Eda if (stateFiledvalue == PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_REPLACE)
204a31ceb91SManojkiran Eda {
205a31ceb91SManojkiran Eda sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN;
206a31ceb91SManojkiran Eda }
207a31ceb91SManojkiran Eda else
208a31ceb91SManojkiran Eda {
209a31ceb91SManojkiran Eda sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_DISABLED;
210a31ceb91SManojkiran Eda }
211a31ceb91SManojkiran Eda }
212a31ceb91SManojkiran Eda info(
213a31ceb91SManojkiran Eda "CM: processing the property change from VPD Present value and sensor opState: {CURR_VAL} and {SENSOR_OP_STATE}",
214a31ceb91SManojkiran Eda "CURR_VAL", presentValue, "SENSOR_OP_STATE", (unsigned)sensorOpState);
215a31ceb91SManojkiran Eda // set the sensor state based on the stateFieldValue
216a31ceb91SManojkiran Eda this->sendStateSensorEvent(sensorId, PLDM_STATE_SENSOR_STATE, 0,
217a31ceb91SManojkiran Eda sensorOpState,
218a31ceb91SManojkiran Eda PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN);
219a31ceb91SManojkiran Eda }
220a31ceb91SManojkiran Eda
getEntityIDfromEffecterID(uint16_t effecterId)221a31ceb91SManojkiran Eda pldm_entity SlotHandler::getEntityIDfromEffecterID(uint16_t effecterId)
222a31ceb91SManojkiran Eda {
223a31ceb91SManojkiran Eda pldm_entity parentFruEntity{};
224a31ceb91SManojkiran Eda uint8_t* pdrData = nullptr;
225a31ceb91SManojkiran Eda uint32_t pdrSize{};
226a31ceb91SManojkiran Eda const pldm_pdr_record* record{};
227a31ceb91SManojkiran Eda do
228a31ceb91SManojkiran Eda {
229a31ceb91SManojkiran Eda record = pldm_pdr_find_record_by_type(pdrRepo, PLDM_STATE_EFFECTER_PDR,
230a31ceb91SManojkiran Eda record, &pdrData, &pdrSize);
231a31ceb91SManojkiran Eda if (record && !pldm_pdr_record_is_remote(record))
232a31ceb91SManojkiran Eda {
233a31ceb91SManojkiran Eda auto pdr = reinterpret_cast<pldm_state_effecter_pdr*>(pdrData);
234a31ceb91SManojkiran Eda auto compositeEffecterCount = pdr->composite_effecter_count;
235a31ceb91SManojkiran Eda auto possible_states_start = pdr->possible_states;
236a31ceb91SManojkiran Eda
237a31ceb91SManojkiran Eda for (auto effecters = 0x00; effecters < compositeEffecterCount;
238a31ceb91SManojkiran Eda effecters++)
239a31ceb91SManojkiran Eda {
240a31ceb91SManojkiran Eda auto possibleStates =
241a31ceb91SManojkiran Eda reinterpret_cast<state_effecter_possible_states*>(
242a31ceb91SManojkiran Eda possible_states_start);
243a31ceb91SManojkiran Eda
244a31ceb91SManojkiran Eda if (possibleStates->state_set_id ==
245a31ceb91SManojkiran Eda PLDM_OEM_IBM_PCIE_SLOT_EFFECTER_STATE &&
246a31ceb91SManojkiran Eda effecterId == pdr->effecter_id)
247a31ceb91SManojkiran Eda {
248a31ceb91SManojkiran Eda parentFruEntity.entity_type = pdr->entity_type;
249a31ceb91SManojkiran Eda parentFruEntity.entity_instance_num = pdr->entity_instance;
250a31ceb91SManojkiran Eda parentFruEntity.entity_container_id = pdr->container_id;
251a31ceb91SManojkiran Eda
252a31ceb91SManojkiran Eda return parentFruEntity;
253a31ceb91SManojkiran Eda }
254a31ceb91SManojkiran Eda }
255a31ceb91SManojkiran Eda }
256a31ceb91SManojkiran Eda } while (record);
257a31ceb91SManojkiran Eda
258a31ceb91SManojkiran Eda return parentFruEntity;
259a31ceb91SManojkiran Eda }
260a31ceb91SManojkiran Eda
fetchSlotSensorState(const std::string & slotObjectPath)261a31ceb91SManojkiran Eda uint8_t SlotHandler::fetchSlotSensorState(const std::string& slotObjectPath)
262a31ceb91SManojkiran Eda {
263a31ceb91SManojkiran Eda std::string adapterObjPath;
264a31ceb91SManojkiran Eda uint8_t sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN;
265a31ceb91SManojkiran Eda
266a31ceb91SManojkiran Eda try
267a31ceb91SManojkiran Eda {
268a31ceb91SManojkiran Eda // get the adapter dbus object path from the slot dbus object path
269a31ceb91SManojkiran Eda adapterObjPath = getAdapterObjPath(slotObjectPath).value();
270a31ceb91SManojkiran Eda }
271a31ceb91SManojkiran Eda catch (const std::bad_optional_access& e)
272a31ceb91SManojkiran Eda {
273a31ceb91SManojkiran Eda error(
274a31ceb91SManojkiran Eda "Failed to get the adapterObjectPath from slotObjectPath : {SLOT_OBJ_PATH} with error ERROR={ERROR}",
275a31ceb91SManojkiran Eda "SLOT_OBJ_PATH", slotObjectPath, "ERROR", e);
276a31ceb91SManojkiran Eda return PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_UNKOWN;
277a31ceb91SManojkiran Eda }
278a31ceb91SManojkiran Eda
279a31ceb91SManojkiran Eda if (fetchSensorStateFromDbus(adapterObjPath))
280a31ceb91SManojkiran Eda {
281a31ceb91SManojkiran Eda sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_ENABLED;
282a31ceb91SManojkiran Eda }
283a31ceb91SManojkiran Eda else
284a31ceb91SManojkiran Eda {
285a31ceb91SManojkiran Eda sensorOpState = PLDM_OEM_IBM_PCIE_SLOT_SENSOR_STATE_DISABLED;
286a31ceb91SManojkiran Eda }
287a31ceb91SManojkiran Eda return sensorOpState;
288a31ceb91SManojkiran Eda }
289a31ceb91SManojkiran Eda
setOemPlatformHandler(pldm::responder::oem_platform::Handler * handler)290a31ceb91SManojkiran Eda void SlotHandler::setOemPlatformHandler(
291a31ceb91SManojkiran Eda pldm::responder::oem_platform::Handler* handler)
292a31ceb91SManojkiran Eda {
293a31ceb91SManojkiran Eda oemPlatformHandler = handler;
294a31ceb91SManojkiran Eda }
295a31ceb91SManojkiran Eda
sendStateSensorEvent(uint16_t sensorId,enum sensor_event_class_states sensorEventClass,uint8_t sensorOffset,uint8_t eventState,uint8_t prevEventState)296a31ceb91SManojkiran Eda void SlotHandler::sendStateSensorEvent(
297a31ceb91SManojkiran Eda uint16_t sensorId, enum sensor_event_class_states sensorEventClass,
298a31ceb91SManojkiran Eda uint8_t sensorOffset, uint8_t eventState, uint8_t prevEventState)
299a31ceb91SManojkiran Eda {
300a31ceb91SManojkiran Eda pldm::responder::oem_ibm_platform::Handler* oemIbmPlatformHandler =
301a31ceb91SManojkiran Eda dynamic_cast<pldm::responder::oem_ibm_platform::Handler*>(
302a31ceb91SManojkiran Eda oemPlatformHandler);
303a31ceb91SManojkiran Eda if (oemIbmPlatformHandler)
304a31ceb91SManojkiran Eda {
305a31ceb91SManojkiran Eda oemIbmPlatformHandler->sendStateSensorEvent(
306a31ceb91SManojkiran Eda sensorId, sensorEventClass, sensorOffset, eventState,
307a31ceb91SManojkiran Eda prevEventState);
308a31ceb91SManojkiran Eda }
309a31ceb91SManojkiran Eda }
310a31ceb91SManojkiran Eda
fetchSensorStateFromDbus(const std::string & adapterObjectPath)311a31ceb91SManojkiran Eda bool SlotHandler::fetchSensorStateFromDbus(const std::string& adapterObjectPath)
312a31ceb91SManojkiran Eda {
313a31ceb91SManojkiran Eda static constexpr auto ItemInterface = "xyz.openbmc_project.Inventory.Item";
314a31ceb91SManojkiran Eda
315a31ceb91SManojkiran Eda try
316a31ceb91SManojkiran Eda {
317a31ceb91SManojkiran Eda auto presentProperty =
318a31ceb91SManojkiran Eda pldm::utils::DBusHandler().getDbusPropertyVariant(
319a31ceb91SManojkiran Eda adapterObjectPath.c_str(), "Present", ItemInterface);
320a31ceb91SManojkiran Eda return std::get<bool>(presentProperty);
321a31ceb91SManojkiran Eda }
322a31ceb91SManojkiran Eda catch (const std::exception& e)
323a31ceb91SManojkiran Eda {
324a31ceb91SManojkiran Eda error(
325a31ceb91SManojkiran Eda "failed to make a d-bus call to Inventory manager from adapterObjectPath : {ADAPTER_OBJ_PATH} with error ERROR={ERROR}",
326a31ceb91SManojkiran Eda "ADAPTER_OBJ_PATH", adapterObjectPath, "ERROR", e);
327a31ceb91SManojkiran Eda }
328a31ceb91SManojkiran Eda
329a31ceb91SManojkiran Eda return false;
330a31ceb91SManojkiran Eda }
331a31ceb91SManojkiran Eda
332a31ceb91SManojkiran Eda } // namespace responder
333a31ceb91SManojkiran Eda } // namespace pldm
334