From ce822444460a6aef6538c36b9c74023c33e2fcae Mon Sep 17 00:00:00 2001 From: Brandon Wyman Date: Mon, 10 Apr 2017 17:48:02 -0500 Subject: Implement changes to read GPIO device for cooling type. Change-Id: If40a54510fb05d67ee0bfdf24026c1d7470897ca Signed-off-by: Brandon Wyman --- cooling-type/cooling_type.hpp | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'cooling-type/cooling_type.hpp') diff --git a/cooling-type/cooling_type.hpp b/cooling-type/cooling_type.hpp index 8775a42..aa02bfa 100644 --- a/cooling-type/cooling_type.hpp +++ b/cooling-type/cooling_type.hpp @@ -1,5 +1,6 @@ #pragma once #include "utility.hpp" +#include namespace phosphor { @@ -11,6 +12,14 @@ namespace type constexpr auto INVENTORY_PATH = "/xyz/openbmc_project/inventory"; constexpr auto INVENTORY_INTF = "xyz.openbmc_project.Inventory.Manager"; +struct FreeEvDev +{ + void operator()(struct libevdev* device) const + { + libevdev_free(device); + } +}; + class CoolingType { using Property = std::string; @@ -39,6 +48,7 @@ class CoolingType */ CoolingType(sdbusplus::bus::bus& bus) : bus(bus) { + //TODO: Issue openbmc/openbmc#1531 - means to default properties. } /** @@ -52,15 +62,16 @@ class CoolingType /** * @brief Updates the inventory properties for CoolingType. * - * @param[in] path - D-Bus path + * @param[in] path - Path to object to update */ - void updateInventory(const std::string&); + void updateInventory(const std::string& path); /** - * @brief Setup the GPIO device for reading cooling type. + * @brief Setup and read the GPIO device for reading cooling type. * - * @param[in] - Path to object to update + * @param[in] path - Path to the GPIO device file to read + * @param[in] pin - Event/key code to read (pin) */ - void setupGpio(const std::string&); + void readGpio(const std::string& path, unsigned int pin); private: /** @brief Connection for sdbusplus bus */ @@ -73,11 +84,11 @@ class CoolingType /** * @brief Construct the inventory object map for CoolingType. * - * @param[in] - Path to object to update + * @param[in] objpath - Path to object to update * * @return The inventory object map to update inventory - */ - ObjectMap getObjectMap(const std::string&); + */ + ObjectMap getObjectMap(const std::string& objpath); }; -- cgit v1.2.1