taler-mdb

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

commit d1436e8642d69a81c745a2dc19b896bf4262d529
parent c29752262ee6474b5af7742c5430a5544521f094
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  9 Nov 2019 19:41:58 +0100

explicitly detect not-found code

Diffstat:
Msrc/main.c | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

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" @@ -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