Implement changes to read GPIO device for cooling type.
Change-Id: If40a54510fb05d67ee0bfdf24026c1d7470897ca
Signed-off-by: Brandon Wyman <bjwyman@gmail.com>
diff --git a/utility.hpp b/utility.hpp
index 05fe60c..880545a 100644
--- a/utility.hpp
+++ b/utility.hpp
@@ -2,6 +2,8 @@
#include <sdbusplus/bus.hpp>
#include <unistd.h>
+#include <fcntl.h>
+
namespace phosphor
{
@@ -31,6 +33,21 @@
}
}
+ int operator()()
+ {
+ return fd;
+ }
+
+ void open(const std::string& pathname, int flags)
+ {
+ fd = ::open(pathname.c_str(), flags);
+ if (-1 == fd)
+ {
+ throw std::runtime_error(
+ "Failed to open file device: " + pathname);
+ }
+ }
+
bool is_open()
{
return fd != -1;