diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-04 14:05:09 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-26 12:02:26 +0530 |
commit | 4902a10c9fabcdf5e1f2868f28cba2d571d55f03 (patch) | |
tree | 9f0662ade186a796fec8bb9d69338c5e55f19b79 /mainapp.cpp | |
parent | affea8bfc77162d8631b48f1eb5e79c06b96302f (diff) | |
download | phosphor-gpio-monitor-4902a10c9fabcdf5e1f2868f28cba2d571d55f03.tar.gz phosphor-gpio-monitor-4902a10c9fabcdf5e1f2868f28cba2d571d55f03.zip |
Populate the file descriptor for the device
On a GPIO chip, there could be many gpio lines and for each line,
there would be a corresponding input device event file.
To know the assertion state of a GPIO line, a descriptor is needed.
This descriptor will later be plugged into sd_event so that the
GPIO state changes can be caught and handled.
Change-Id: Idc8c2b429688fea2a5124b96677085b1be48128b
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'mainapp.cpp')
-rw-r--r-- | mainapp.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/mainapp.cpp b/mainapp.cpp index 671b73c..18bc4ca 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -17,6 +17,7 @@ #include <iostream> #include <string> #include "argument.hpp" +#include "monitor.hpp" static void exitWithError(const char* err, char** argv) { @@ -44,7 +45,6 @@ int main(int argc, char** argv) { exitWithError("Key not specified.", argv); } - // TODO : Convert key to integer // Parse out assertion polarity interested in // Its either 1 or 0 for press / release @@ -53,12 +53,15 @@ int main(int argc, char** argv) { exitWithError("Polarity not specified.", argv); } - // TODO : Convert polarity to integer // Parse out target argument. It is fine if the caller does not // pass this if they are not interested in calling into any target // on meeting a condition. auto target = (options)["target"]; + // Create a GPIO monitor object and let it do all the rest + phosphor::gpio::Monitor monitor(path, std::stoi(key), + std::stoi(polarity),target); + return 0; } |