taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit e1ff7b58c3968a70e0de5cc102dc99546350e5a3
parent bd2ccff9c4361b5bff9b9127c31ab318ab24abb9
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Tue, 24 May 2022 11:13:37 +0200

always try gpio

Diffstat:
Msrc/main.c | 48++----------------------------------------------
1 file changed, 2 insertions(+), 46 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -777,11 +777,6 @@ static int disable_tty; static int sold_out_enabled; /** - * True if we have the 'reset' button on GPIO. - */ -static bool have_gpio; - -/** * Taler wallet application identifier */ static const uint8_t taler_aid[] = { 0xF0, 0x00, 0x54, 0x41, 0x4c, 0x45, 0x52 }; @@ -997,6 +992,8 @@ order_delete_cb ( static void cleanup_payment (struct PaymentActivity *pa) { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Cleaning up payment\n"); if ( (! pa->paid) && (NULL != pa->order_id) ) { @@ -1202,36 +1199,6 @@ 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"); } @@ -3206,7 +3173,6 @@ run (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/export for cancel button\n"); - have_gpio = false; } else { @@ -3217,18 +3183,12 @@ run (void *cls, GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", "/sys/class/gpio/export"); - have_gpio = true; /* try anyway */ - } - else - { - have_gpio = true; } GNUNET_assert (0 == close (efd)); } } /* set direction: input */ - if (have_gpio) { int dfd; @@ -3238,7 +3198,6 @@ run (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/gpio23/direction for cancel button\n"); - have_gpio = false; } else { @@ -3249,13 +3208,11 @@ run (void *cls, GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", "/sys/class/gpio/gpio23/direction"); - have_gpio = false; } } GNUNET_assert (0 == close (dfd)); } - if (have_gpio) { /* actually open fd for reading the state */ cancel_button.cancelbuttonfd = open ("/sys/class/gpio/gpio23/value", @@ -3264,7 +3221,6 @@ run (void *cls, { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Unable to open /gpio/gpio23/value for cancel button\n"); - have_gpio = false; } } else