commit caf762054a2606d1523ca57ae16446e7f9565c0a
parent eacacaf002e89b1591c80e480616278c6499a678
Author: BOSS_Marco <bossm8@students.bfh.ch>
Date: Sat, 9 Nov 2019 20:06:16 +0100
merged
Diffstat:
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
-AC_CONFIG_SRCDIR([src/])
+AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
diff --git 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"
@@ -123,7 +128,6 @@ static char *authorization;
static struct PaymentActivity *payment_activity;
-
/**
* FIXME: read from configuration file instead!
* GNUNET_CONFIGURATION_* iteration over values.
@@ -155,7 +159,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],
@@ -331,7 +346,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