summaryrefslogtreecommitdiffstats
path: root/monitor.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'monitor.hpp')
-rw-r--r--monitor.hpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/monitor.hpp b/monitor.hpp
index 34803c1..68bf447 100644
--- a/monitor.hpp
+++ b/monitor.hpp
@@ -3,6 +3,7 @@
#include <unistd.h>
#include <string>
#include <linux/input.h>
+#include <libevdev/libevdev.h>
#include <systemd/sd-event.h>
#include <sdbusplus/bus.hpp>
#include "file.hpp"
@@ -31,6 +32,16 @@ struct EventSourceDeleter
};
using EventSourcePtr = std::unique_ptr<sd_event_source, EventSourceDeleter>;
+/* Need a custom deleter for freeing up evdev struct */
+struct EvdevDeleter
+{
+ void operator()(struct libevdev* device) const
+ {
+ libevdev_free(device);
+ }
+};
+using EvdevPtr = std::unique_ptr<struct libevdev, EvdevDeleter>;
+
/** @class Monitor
* @brief Responsible for catching GPIO state change
* condition and taking actions
@@ -118,6 +129,9 @@ class Monitor
/** @brief File descriptor manager */
FileDescriptor fd;
+ /** event structure */
+ EvdevPtr device;
+
/** @brief Completion indicator */
bool complete = false;
@@ -127,11 +141,11 @@ class Monitor
/** @brief attaches FD to events and sets up callback handler */
void registerCallback();
- /** @brief Analyzes the GPIO event and starts configured target
- *
- * @return - For now, returns zero
- */
- int analyzeEvent();
+ /** @brief Analyzes the GPIO event and starts configured target */
+ void analyzeEvent();
+
+ /** @brief Initializes evdev handle with the fd */
+ void initEvDev();
};
} // namespace gpio
OpenPOWER on IntegriCloud