aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaojie Sun <shaojie.sun@linaro.com>2013-09-17 14:15:19 +0800
committerShaojie Sun <shaojie.sun@linaro.com>2013-09-18 11:33:02 +0800
commited97318cfc768bb34bb0baf07936fee752928615 (patch)
tree8697149f526a4047add20ae07722d6e637359619
parent2489bc70a2e3084cb8d070c9b5b4cc711f67c0e0 (diff)
Read gpio value after gpio direction changed.
When gpio direction was changed from IN to OUT though sysfs. gpio value would changed to zero. So after gpio direction changed, we must read gpio value again. Signed-off-by: Shaojie Sun <shaojie.sun@linaro.com>
-rw-r--r--gpio.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/gpio.c b/gpio.c
index 84f150f..7cc16f7 100644
--- a/gpio.c
+++ b/gpio.c
@@ -284,6 +284,7 @@ static int gpio_change(int keyvalue)
strcpy(gpio->direction, "in");
file_write_value(t->path, "direction", "%s", &gpio->direction);
file_read_value(t->path, "direction", "%s", &gpio->direction);
+ file_read_value(t->path, "value", "%d", &gpio->value);
break;