gnunet-svn
[Top][All Lists]
Advanced

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

[taler-taler-mdb] 35/93: explicitly detect not-found code


From: gnunet
Subject: [taler-taler-mdb] 35/93: explicitly detect not-found code
Date: Mon, 18 Nov 2019 21:12:58 +0100

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

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

commit d1436e8642d69a81c745a2dc19b896bf4262d529
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Nov 9 19:41:58 2019 +0100

    explicitly detect not-found code
---
 src/main.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c
index 0de6f34..19aef59 100644
--- a/src/main.c
+++ b/src/main.c
@@ -49,6 +49,11 @@ along with
  */
 #define APDU_SUCCESS "\x90\x00"
 
+/**
+ * Code returned by libnfc in case Taler wallet is not installed.
+ */
+#define APDU_NOT_FOUND "\x6a\x82"
+
 /* json order request keys */
 #define SNACK_JSON_REQ_ORDER "order"
 #define SNACK_JSON_REQ_SUMMARY "summary"
@@ -125,7 +130,6 @@ static char *authorization;
 static struct PaymentActivity *payment_activity;
 
 
-
 /**
  * FIXME: read from configuration file instead!
  * GNUNET_CONFIGURATION_* iteration over values.
@@ -157,7 +161,8 @@ SNACK_print_hex_info (const char*message,
   char hex[5] = {""};
   char str[64] = {""};
 
-  for ( unsigned int i = 0; i < sizeHex; ++i ) {
+  for (unsigned int i = 0; i < sizeHex; ++i)
+  {
     sprintf (hex, "%.2x ", hexArray[i]);
     strcat (str, hex);
   }
@@ -321,6 +326,16 @@ wallet_select_aid (void *cls)
                                          pa);
     return;
   }
+  if (0 == memcmp (response,
+                   APDU_NOT_FOUND,
+                   sizeof (response)))
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Taler wallet NOT found on this device\n");
+    pa->task = GNUNET_SCHEDULER_add_now (&connect_target,
+                                         pa);
+    return;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
               "AID selection failure, return code: %x%x, trying to find 
another NFC client\n",
               response[0],
@@ -330,7 +345,6 @@ wallet_select_aid (void *cls)
 }
 
 
-
 /* upper and lower bounds for mifare targets uid length */
 #define UID_LEN_UPPER 7
 #define UID_LEN_LOWER 4

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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