summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-18 18:42:45 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-18 18:42:45 +0200
commit16bc3d26021925542787dd1f52204cd689a13051 (patch)
treec809641be776d8919aef3a98cfd42df590660b38 /src
parent11f22a4394efee08d832fbebab4f961d1bf5f578 (diff)
downloadtaler-mdb-16bc3d26021925542787dd1f52204cd689a13051.tar.gz
taler-mdb-16bc3d26021925542787dd1f52204cd689a13051.tar.bz2
taler-mdb-16bc3d26021925542787dd1f52204cd689a13051.zip
unexport gpio when done
Diffstat (limited to 'src')
-rw-r--r--src/main.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index c90b946..756f166 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1202,6 +1202,36 @@ shutdown_task (void *cls)
products_length,
0);
}
+ if (have_gpio)
+ {
+ /* release gpio pin for cancel button */
+ int efd;
+
+ efd = open ("/sys/class/gpio/unexport",
+ O_WRONLY);
+ if (-1 == efd)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Unable to open /gpio/unexport for cancel button\n");
+ have_gpio = false;
+ }
+ else
+ {
+ if (2 != write (efd,
+ "23",
+ 2))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "write",
+ "/sys/class/gpio/unexport");
+ }
+ else
+ {
+ have_gpio = true;
+ }
+ GNUNET_assert (0 == close (efd));
+ }
+ }
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Shutdown complete (except for MDB)\n");
}
@@ -3170,7 +3200,6 @@ run (void *cls,
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"write",
"/sys/class/gpio/export");
- have_gpio = false;
}
else
{