gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-mdb] branch master updated: always try gpio


From: gnunet
Subject: [taler-taler-mdb] branch master updated: always try gpio
Date: Tue, 24 May 2022 11:13:42 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository taler-mdb.

The following commit(s) were added to refs/heads/master by this push:
     new e1ff7b5  always try gpio
e1ff7b5 is described below

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

    always try gpio
---
 src/main.c | 48 ++----------------------------------------------
 1 file changed, 2 insertions(+), 46 deletions(-)

diff --git a/src/main.c b/src/main.c
index 3f809dd..22c346f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -776,11 +776,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
  */
@@ -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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]