commit d5181d3b5bdcc731e77eeed4257bae140543dd31
parent ba53ae588fa870ac7db4aa06a36e8904cfbb8ae1
Author: Tellenbach Reto <tellr1@bfh.ch>
Date: Mon, 8 Jun 2026 14:07:49 +0200
[dbg] State-logic: Scan QR-code, made qr-show nonblocking
Diffstat:
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/taler-digitizer.c b/src/taler-digitizer.c
@@ -187,6 +187,11 @@ static struct TALER_BANK_GetAccountsHandle *get_accounts_handle;
*/
static struct TALER_BANK_PostCreateWithdrawalHandle *post_accounts_withdrawal_handle;
+/**
+ * framebuffer for qr-show
+ */
+static FILE *fp;
+
enum
DIGITIZER_states
{
@@ -300,7 +305,6 @@ static void state_controller_task(void *cls);
enum GNUNET_GenericReturnValue
run_qr_show(int showtime)
{
- FILE *fp;
//char buffer[FRAMEBUFFER_SIZE];
char *command;
char *url;
@@ -325,15 +329,28 @@ run_qr_show(int showtime)
fp = popen(command, "r");
if (fp == NULL) {
GNUNET_free(url);
+ GNUNET_free(command);
+ GNUNET_free(path);
TALER_LOG_ERROR("Failed to open framebuffer\n");
return GNUNET_SYSERR;
}
GNUNET_free(url);
- pclose(fp);
+ GNUNET_free(command);
+ GNUNET_free(path);
return GNUNET_OK;
}
+void
+stop_qr_show(void)
+{
+ if (NULL != fp)
+ {
+ pclose(fp);
+ fp = NULL;
+ }
+}
+
/**
* Joinn currency and V.F format value string to TALER amount".
*
@@ -433,6 +450,7 @@ on_get_accounts_done(void *cls,
"taler-digitizer",
"BANK_ACCOUNT",
"bank account is not in active state");
+ stop_qr_show();
state = DIGITIZER_STATE_TERMINAL_ERROR;
GNUNET_SCHEDULER_add_now(state_controller_task,NULL);
return;