Retry for file visibility in user space
In some corner cases, there is a delay between the parser code coming
up against udev generated due to binding the driver, and the file
appearing in user space.
As a result the check for file existence fails for those situations and
post fail action gets executed. This removes the GPIO line to the file.
Whereas, parser code will be in process of reading that file at the
same time. Hence closing the GPIO line causes file read error on
parser side.
The timer is to buy some time for file to appear in user space before
cutting off the GPIO line to it.
Test:
This was a script driven testing where system was brought down and
again restarted after random time interval.
Code has been tested against that script and it is working fine.
Change-Id: I8383372b27e48bf1cbc569562e396a0bceb908e5
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/const.hpp b/const.hpp
index bbe6ee9..86adcb8 100644
--- a/const.hpp
+++ b/const.hpp
@@ -98,6 +98,8 @@
static constexpr auto VALUE_6 = 6;
static constexpr auto VALUE_7 = 7;
static constexpr auto VALUE_8 = 8;
+static constexpr auto VALUE_10 = 10;
+static constexpr auto VALUE_100000 = 100000;
static constexpr auto MASK_BYTE_BITS_6 = 0x40;
static constexpr auto MASK_BYTE_BITS_7 = 0x80;