diff options
author | Brandon Wyman <bjwyman@gmail.com> | 2017-03-31 18:13:21 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-05-19 16:19:06 +0000 |
commit | fef0295a8d87754e491dcf133ea927b5c4d56303 (patch) | |
tree | 625df8225e8d9681ff1b5f9afb77104c9e899946 /cooling-type/cooling_type.cpp | |
parent | af5d4c5ec0e07ba7a87ddff3f2066d9b3cbb52f8 (diff) | |
download | phosphor-fan-presence-fef0295a8d87754e491dcf133ea927b5c4d56303.tar.gz phosphor-fan-presence-fef0295a8d87754e491dcf133ea927b5c4d56303.zip |
Fill in shell functions/files for cooling type.
Change-Id: I8d18d3141e955adeffdd8122ebb17549c88edd77
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
Diffstat (limited to 'cooling-type/cooling_type.cpp')
-rw-r--r-- | cooling-type/cooling_type.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cooling-type/cooling_type.cpp b/cooling-type/cooling_type.cpp new file mode 100644 index 0000000..66d9ac9 --- /dev/null +++ b/cooling-type/cooling_type.cpp @@ -0,0 +1,59 @@ +#include <unistd.h> +#include <fcntl.h> +#include <sdbusplus/bus.hpp> +#include <phosphor-logging/log.hpp> +#include "cooling_type.hpp" + +namespace phosphor +{ +namespace cooling +{ +namespace type +{ + +void CoolingType::setAirCooled() +{ + airCooled = true; +} + +void CoolingType::setWaterCooled() +{ + waterCooled = true; +} + +void CoolingType::setupGpio(const std::string& gpioPath) +{ + using namespace phosphor::logging; + + gpioFd = open(gpioPath.c_str(), O_RDONLY); + if (gpioFd.is_open()) + { + auto rc = 0;//libevdev_new_from_fd(gpiofd, &gpioDev);//FIXME + if (rc < 0) + { + throw std::runtime_error("Failed to get libevdev from " + + gpioPath + " rc = " + + std::to_string(rc)); + } + + //TODO - more to go here? + } + else + { + throw std::runtime_error("Failed to open GPIO file device"); + } + +} + +void CoolingType::updateInventory(const std::string& objpath) +{ + //TODO + // setProperty(bus, ..., "AirCooled"); + // setProperty(bus, ..., "WaterCooled"); +} + +} +} +} + +// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |