diff options
author | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-18 23:24:06 +0300 |
---|---|---|
committer | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-22 21:45:49 +0300 |
commit | 1f51e61e7295139bf768f731405ca1458e6a9684 (patch) | |
tree | 031ea24aecc753d6bd223dbb14174bac6f470d22 /gpiodaemon | |
parent | ef102aac7c0f8c0fe175094fd3643bc65ed643cc (diff) | |
download | provingground-1f51e61e7295139bf768f731405ca1458e6a9684.tar.xz |
Make 'set value' available only on output GPIOs
This commit fixes the 'Value' property handling code to make it
available only on output GPIOs.
Change-Id: I6c92df47e01339a8becf9788004f400834695a7c
Signed-off-by: Yoo, Jae Hyun <jae.hyun.yoo@intel.com>
Diffstat (limited to 'gpiodaemon')
-rw-r--r-- | gpiodaemon/src/gpiodaemon.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gpiodaemon/src/gpiodaemon.cpp b/gpiodaemon/src/gpiodaemon.cpp index 361b189..f762656 100644 --- a/gpiodaemon/src/gpiodaemon.cpp +++ b/gpiodaemon/src/gpiodaemon.cpp @@ -125,12 +125,13 @@ void GpioManager::addObject(const std::string& path) if (dbusGpio) { - // If Gpio enabled property is set as true then - // reject set request - if (dbusGpio->getEnabled()) + // If Gpio enabled property is set as true and + // direction is out then handle the set request + Gpio gpio = + Gpio(std::to_string(dbusGpio->getNumber())); + if (dbusGpio->getEnabled() && + gpio.getDirection() == "out") { - Gpio gpio = - Gpio(std::to_string(dbusGpio->getNumber())); bool setVal = req; if (inverted) { @@ -172,8 +173,8 @@ void GpioManager::addObject(const std::string& path) if (dbusGpio) { - // If Gpio enabled property is set as true than - // reject request + // If Gpio enabled property is set as true then + // handle the request if (dbusGpio->getEnabled()) { Gpio gpio = |