diff options
author | Brandon Wyman <bjwyman@gmail.com> | 2017-04-10 17:48:02 -0500 |
---|---|---|
committer | Brandon Wyman <bjwyman@gmail.com> | 2017-05-22 14:35:51 -0500 |
commit | ce822444460a6aef6538c36b9c74023c33e2fcae (patch) | |
tree | 7301de7ecab9828785dd534b20325c9049de982a /cooling-type/cooling_type.hpp | |
parent | 8798854f0aab767edb8798fb014de5b4b9f7fae2 (diff) | |
download | phosphor-fan-presence-ce822444460a6aef6538c36b9c74023c33e2fcae.tar.gz phosphor-fan-presence-ce822444460a6aef6538c36b9c74023c33e2fcae.zip |
Implement changes to read GPIO device for cooling type.
Change-Id: If40a54510fb05d67ee0bfdf24026c1d7470897ca
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Diffstat (limited to 'cooling-type/cooling_type.hpp')
-rw-r--r-- | cooling-type/cooling_type.hpp | 27 |
1 files changed, 19 insertions, 8 deletions
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 <libevdev/libevdev.h> 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); }; |