cash2ecash

cash2ecash: cash acceptor that issues digital cash (experimental)
Log | Files | Refs | README | LICENSE

commit ea7843b2adfc4dc46ba9ada36cef6312d58f6b17
parent 5fa872e12240a6691508090341aa692c84ee0327
Author: Tellenbach Reto <tellr1@bfh.ch>
Date:   Sun,  7 Jun 2026 18:18:27 +0200

[dbg] State-logic: show QR code

Diffstat:
Msrc/taler-digitizer.c | 23++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/src/taler-digitizer.c b/src/taler-digitizer.c @@ -24,6 +24,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <gnunet/gnunet_util_lib.h> #include "taler_digitizer_util.h" #include "taler/taler_digitizer_service.h" @@ -40,7 +41,7 @@ #define DIGITIZER_PERSON_WITHDRAWAL_PERIOD_TIME_UNIT GNUNET_TIME_UNIT_DAYS #define FRAMEBUFFER_SIZE 256 -#define PATH_QR_SHOW "../ext/QRshow" +#define PATH_QR_SHOW "/ext/QRshow" #define SCAN_QR_TIMEOUT_SECONDS 100 @@ -295,19 +296,27 @@ struct DIGITIZER_DisplayContext *display_ctx; static void state_controller_task(void *cls); enum GNUNET_GenericReturnValue -run_qr_show(int showtime, const char *wopid_url) +run_qr_show(int showtime) { FILE *fp; //char buffer[FRAMEBUFFER_SIZE]; char *command; char *url; - url = TALER_url_join(wopid_url, + char *path; + + const char *prefix = getenv("TALER_DIGITIZER_PREFIX"); + if (NULL != prefix) + GNUNET_asprintf (&path, "%s%s", prefix,PATH_QR_SHOW); + else + path = GNUNET_strdup ("/usr/local/bin/taler-digitizer-qr-show"); + url = TALER_url_join(state_ctx->wi.taler_withdraw_uri, "", "external-confirmation", - "1"); + "1", + NULL); GNUNET_asprintf(&command, - "%s -c ../taler-digitizer.conf -d \"%d s\" %s\n", - PATH_QR_SHOW, + "%s -c taler-digitizer.conf -d \"%d s\" %s\n", + path, showtime, url); fp = popen(command, "r"); @@ -985,7 +994,7 @@ static void ScanQR_state_task(void *cls) (void)cls; struct GNUNET_TIME_Relative delay; delay = GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS,SCAN_QR_TIMEOUT_SECONDS); - if(GNUNET_OK != run_qr_show(SCAN_QR_TIMEOUT_SECONDS, state_ctx->wi.taler_withdraw_uri)) + if(GNUNET_OK != run_qr_show(SCAN_QR_TIMEOUT_SECONDS)) { TALER_LOG_ERROR("run_qr_show failed\n"); state = DIGITIZER_STATE_CANCEL_WITHDRAWAL;