diff options
author | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-17 20:21:07 +0300 |
---|---|---|
committer | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-17 20:21:07 +0300 |
commit | 3c477c551311e0d90e43020d0c4ea0fe27b7f08e (patch) | |
tree | aa2e7af03d87269561ccca0f6ecee5c7d6a032be /gpiodaemon | |
parent | 02e39dd2b8f8ebc846417f4950d122f3b6da8f78 (diff) | |
download | provingground-3c477c551311e0d90e43020d0c4ea0fe27b7f08e.tar.xz |
Block 'edge' setting on output GPIOs
Setting of 'edge' property on an output GPIO causes this warning
in kernel:
gpio gpiochip10: (1e780000.gpio): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
This commit make it does the 'edge' setting only on input GPIOs
to fix the issue.
Change-Id: I35c866598b82e2d05defd8492900345a88325ed3
Signed-off-by: Yoo, Jae Hyun <jae.hyun.yoo@intel.com>
Diffstat (limited to 'gpiodaemon')
-rw-r--r-- | gpiodaemon/src/gpiodaemon.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/gpiodaemon/src/gpiodaemon.cpp b/gpiodaemon/src/gpiodaemon.cpp index 2ef9c3a..361b189 100644 --- a/gpiodaemon/src/gpiodaemon.cpp +++ b/gpiodaemon/src/gpiodaemon.cpp @@ -261,15 +261,19 @@ GpioState::GpioState(const std::string gpioName_, const uint16_t gpioNumber, return; } - std::ofstream deviceFileEdge(device + "/edge"); - if (!deviceFileEdge.good()) + Gpio gpio = Gpio(std::to_string(gpioNumber)); + if (gpio.getDirection() == "in") { - phosphor::logging::log<phosphor::logging::level::INFO>( - ("GpioState:Error setting edge for" + device).c_str()); - return; + std::ofstream deviceFileEdge(device + "/edge"); + if (!deviceFileEdge.good()) + { + phosphor::logging::log<phosphor::logging::level::INFO>( + ("GpioState:Error setting edge for" + device).c_str()); + return; + } + deviceFileEdge << "both"; + deviceFileEdge.close(); } - deviceFileEdge << "both"; // Will success only for gpio.direction == "in" - deviceFileEdge.close(); inputDev.assign(boost::asio::ip::tcp::v4(), fdValue); monitor(); |