diff options
author | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-04 14:08:26 +0530 |
---|---|---|
committer | Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com> | 2017-04-27 14:42:10 +0530 |
commit | ba7301300ef8f3950fa02b4675422cba6a98ee4b (patch) | |
tree | 489d5d55afeaf6399f700f88d1b0fe11670f8bff /mainapp.cpp | |
parent | 0b95603eb48a72234b8fc618dcc4db13b6f4d079 (diff) | |
download | phosphor-gpio-monitor-ba7301300ef8f3950fa02b4675422cba6a98ee4b.tar.gz phosphor-gpio-monitor-ba7301300ef8f3950fa02b4675422cba6a98ee4b.zip |
Call defined target when GPIO line is asserted
Change-Id: Ia5445a8d6585acfec69783ba158c8d866d526e97
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'mainapp.cpp')
-rw-r--r-- | mainapp.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/mainapp.cpp b/mainapp.cpp index 6290366..1dd7e80 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -75,8 +75,20 @@ int main(int argc, char** argv) // Create a monitor object and let it do all the rest phosphor::gpio::Monitor monitor(path, std::stoi(key), std::stoi(polarity), target, eventP); - // Wait for events - sd_event_loop(eventP.get()); + + // Wait for client requests until this application has processed + // at least one expected GPIO state change + while(!monitor.completed()) + { + // -1 denotes wait for ever + r = sd_event_run(eventP.get(), (uint64_t)-1); + if (r < 0) + { + log<level::ERR>("Failure in processing request", + entry("ERROR=%s", strerror(-r))); + break; + } + } return 0; } |