gui: share code to wait for buttons with ci auto-click
What changed, and why it matters
This commit is a code cleanup: it pulls the logic for waiting on a button press into a single shared helper function so the same code isn't repeated in many places. The behavior is essentially unchanged. The only functional difference is that one screen (the mnemonic setup) now explicitly treats a timeout as an error in normal builds, whereas before it would have hit a generic assertion. This is a minor hardening improvement, not a security vulnerability.
No action required. Treat as routine refactoring. If reviewing, verify that all replaced call sites preserve the intended default button for CI builds and that the new BTN_EVENT_TIMEOUT enum value does not collide with existing button IDs.
Security signals we found
Refactoring only: consolidates duplicated button-wait logic into a single helper
No change to production behavior under normal (non-CI) builds except explicit timeout handling
CI auto-click behavior remains gated by CONFIG_DEBUG_UNATTENDED_CI compile-time flag
One defensive assertion added for unexpected timeout in mnemonic setup
Evidence from the diff
The change introduces gui_activity_wait_button() in main/gui.c and replaces dozens of inline #ifndef CONFIG_DEBUG_UNATTENDED_CI blocks across 18 files with calls to this helper. In non-CI builds the helper calls gui_activity_wait_event(…, max_wait=0) and returns BTN_EVENT_TIMEOUT if the wait fails; in CI builds it waits CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS and returns the supplied default_event_id. The timeout return value is new, but callers already treated non-success as timeout/deny. In initialise_with_mnemonic() the default_event_id is now BTN_EVENT_TIMEOUT and the subsequent switch has an explicit timeout assertion case, making the timeout path explicit rather than falling through to an assertion. No new attack surface or vulnerability is introduced; the change is a refactor with a small defensive improvement.
Changed components
main/gui.cmain/gui.hmain/button_events.hmain/ble/ble.cmain/process/dashboard.cmain/process/mnemonic.cmain/qrmode.cmain/ui/confirm_address.cmain/ui/descriptor.cmain/ui/dialogs.cmain/ui/multisig.cmain/ui/ota.cmain/ui/otpauth.cmain/ui/sign_identity.cmain/ui/sign_message.cmain/ui/sign_tx.cmain/ui/signer.cmain/ui/update_pinserver.cInspect captured patch +78 / −327
diff --git a/main/ble/ble.c b/main/ble/ble.c
index f80ff1e..e947032 100644
--- a/main/ble/ble.c
+++ b/main/ble/ble.c
@@ -748,21 +748,10 @@ static int ble_gap_event(struct ble_gap_event* event, void* arg)
gui_activity_t* const act = make_ble_confirmation_activity(event->passkey.params.numcmp);
JADE_LOGI("Showing BLE confirm screen");
- int32_t ev_id;
gui_set_current_activity(act);
-// In a debug unattended ci build, assume 'confirm' button clicked after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(
- act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 30000 / portTICK_PERIOD_MS);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_BLE_CONFIRM;
-#endif
-
- if (ret && ev_id == BTN_BLE_CONFIRM) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_BLE_CONFIRM);
+ if (ev_id == BTN_BLE_CONFIRM) {
// Confirmed
JADE_LOGI("User pressed confirm");
pkey.numcmp_accept = 1;
@@ -772,7 +761,7 @@ static int ble_gap_event(struct ble_gap_event* event, void* arg)
JADE_LOGE("ble_sm_inject_io errored: %d", rc);
}
} else {
- if (ret) {
+ if (ev_id != BTN_EVENT_TIMEOUT) {
// Denied
JADE_LOGI("User pressed deny");
} else {
diff --git a/main/button_events.h b/main/button_events.h
index 6b6af08..b1d09c1 100644
--- a/main/button_events.h
+++ b/main/button_events.h
@@ -2,6 +2,8 @@
#define BUTTON_EVENTS_H_
#include "sdkconfig.h"
typedef enum {
+ BTN_EVENT_TIMEOUT,
+
BTN_BACK,
BTN_HELP,
BTN_YES,
diff --git a/main/gui.c b/main/gui.c
index d084533..4324a23 100644
--- a/main/gui.c
+++ b/main/gui.c
@@ -2615,6 +2615,20 @@ bool gui_activity_wait_event(gui_activity_t* activity, const char* event_base, u
return ret == ESP_OK;
}
+int32_t gui_activity_wait_button(gui_activity_t* activity, const int32_t default_event_id)
+{
+ int32_t ev_id = default_event_id;
+#ifndef CONFIG_DEBUG_UNATTENDED_CI
+ if (!gui_activity_wait_event(activity, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0)) {
+ ev_id = BTN_EVENT_TIMEOUT;
+ }
+#else
+ gui_activity_wait_event(activity, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
+ CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
+#endif
+ return ev_id;
+}
+
// Update the title associated with the passed activity
void gui_set_activity_title(gui_activity_t* activity, const char* title)
{
diff --git a/main/gui.h b/main/gui.h
index f548861..8bca0d6 100644
--- a/main/gui.h
+++ b/main/gui.h
@@ -461,6 +461,7 @@ void gui_activity_register_event(
gui_activity_t* activity, const char* event_base, uint32_t event_id, esp_event_handler_t handler, void* args);
bool gui_activity_wait_event(gui_activity_t* activity, const char* event_base, uint32_t event_id,
esp_event_base_t* trigger_event_base, int32_t* trigger_event_id, void** trigger_event_data, TickType_t max_wait);
+int32_t gui_activity_wait_button(gui_activity_t* activity, int32_t default_event_id);
void gui_set_activity_initial_selection(gui_view_node_t* node);
void gui_set_active(gui_view_node_t* node, bool value);
diff --git a/main/process/dashboard.c b/main/process/dashboard.c
index 9f47d91..10cd481 100644
--- a/main/process/dashboard.c
+++ b/main/process/dashboard.c
@@ -777,18 +777,8 @@ static void select_initial_connection(const bool offer_qr_temporary)
while (initialisation_source == SOURCE_NONE) {
gui_set_current_activity(act);
- int32_t ev_id;
- // In a debug unattended ci build, assume 'USB' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_CONNECT_VIA_USB;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_CONNECT_VIA_USB);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_CONNECT_VIA_USB) {
// Set USB/SERIAL source
initialisation_source = SOURCE_SERIAL;
@@ -948,20 +938,12 @@ static void handle_ble(void)
gui_activity_t* const act_status = make_carousel_activity("Bluetooth Status", NULL, &status_textbox);
update_ble_carousel_label(status_textbox, enabled);
- int32_t ev_id;
while (true) {
// Show, and await button click
gui_set_current_activity(act);
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_BLE_EXIT;
-#endif
- if (ret) {
+ int32_t ev_id = gui_activity_wait_button(act, BTN_BLE_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_BLE_STATUS) {
gui_set_current_activity(act_status);
while (true) {
@@ -1377,20 +1359,12 @@ static void handle_passphrase_prefs()
gui_activity_t* const act_method = make_carousel_activity("Method", NULL, &method_textbox);
gui_update_text(method_textbox, passphrase_method_desc_from_flags(type));
- int32_t ev_id;
while (true) {
// Show, and await button click
gui_set_current_activity(act);
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- bool ret = true;
- ev_id = BTN_PASSPHRASE_EXIT;
-#endif
- if (ret) {
+ int32_t ev_id = gui_activity_wait_button(act, BTN_PASSPHRASE_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_PASSPHRASE_FREQUENCY) {
// Never -> Once -> Always -> Once ...
gui_set_current_activity(act_freq);
@@ -1472,22 +1446,12 @@ static bool display_hotp_screen(const otpauth_ctx_t* otp_ctx, const char* token,
JADE_ASSERT(token);
gui_activity_t* const act = make_show_hotp_code_activity(otp_ctx->name, token, confirm_only);
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_OTP_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_OTP_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_OTP_DETAILS) {
const bool is_valid = true; // asserted above
const bool initial_confirmation = false;
diff --git a/main/process/mnemonic.c b/main/process/mnemonic.c
index e6d8a6e..63964e5 100644
--- a/main/process/mnemonic.c
+++ b/main/process/mnemonic.c
@@ -1333,13 +1333,11 @@ void initialise_with_mnemonic(const bool temporary_restore, const bool force_qr_
while (!got_mnemonic) {
gui_set_current_activity_ex(act, true);
- // In a debug unattended ci build, use hardcoded mnemonic after a short delay
- int32_t ev_id;
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_EVENT_TIMEOUT);
#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
- JADE_ASSERT(ret);
-
switch (ev_id) {
+ case BTN_EVENT_TIMEOUT:
+ JADE_ASSERT(false);
case BTN_MNEMONIC_EXIT:
// Abandon setting up mnemonic altogether
goto cleanup;
@@ -1399,8 +1397,7 @@ void initialise_with_mnemonic(const bool temporary_restore, const bool force_qr_
continue;
}
#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
+ // In a debug unattended ci build, use hardcoded mnemonic after a short delay
strcpy(mnemonic,
"fish inner face ginger orchard permit useful method fence kidney chuckle party favorite sunset draw "
"limb "
@@ -1509,21 +1506,12 @@ void handle_bip85_mnemonic()
gui_activity_t* act = make_bip85_mnemonic_words_activity();
uint8_t nwords = 0;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_BIP85_12_WORDS;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_BIP85_12_WORDS);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_BIP85_12_WORDS) {
nwords = 12;
break;
diff --git a/main/qrmode.c b/main/qrmode.c
index b53b32a..27c33f9 100644
--- a/main/qrmode.c
+++ b/main/qrmode.c
@@ -292,16 +292,8 @@ static bool handle_xpub_options(uint32_t* qr_flags)
// Show, and await button click
gui_set_current_activity(act);
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_XPUB_OPTIONS_EXIT;
-#endif
- if (ret) {
+ int32_t ev_id = gui_activity_wait_button(act, BTN_XPUB_OPTIONS_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_XPUB_OPTIONS_SCRIPTTYPE) {
gui_set_current_activity(act_scripttype);
while (true) {
@@ -393,16 +385,8 @@ void display_xpub_qr(void)
// Show, and await button click
gui_set_current_activity(act);
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_XPUB_EXIT;
-#endif
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_XPUB_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_XPUB_OPTIONS) {
if (handle_xpub_options(&qr_flags)) {
// Options were updated - re-create xpub screen
@@ -869,16 +853,8 @@ static bool handle_qr_options(uint32_t* qr_flags)
// Show, and await button click
gui_set_current_activity(act);
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_QR_OPTIONS_EXIT;
-#endif
- if (ret) {
+ int32_t ev_id = gui_activity_wait_button(act, BTN_QR_OPTIONS_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
// NOTE: For Density and Speed :- HIGH|LOW > HIGH > LOW
// Rotate through: LOW -> HIGH -> HIGH|LOW -> LOW -> ...
// unset/default is treated as HIGH ie. the middle value
@@ -981,16 +957,8 @@ static void display_bcur_qr(const char* message[], const size_t message_size, co
// Show, and await button click
gui_set_current_activity(act);
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_QR_DISPLAY_EXIT;
-#endif
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_DISPLAY_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_QR_OPTIONS) {
if (handle_qr_options(&qr_flags)) {
// Options were updated - re-create psbt qr screen
@@ -1437,21 +1405,12 @@ void await_single_qr_activity(
// Show, and await button click - note gui takes ownership of icon
gui_activity_t* const act = make_show_qr_activity(message, message_size, qr_icon, 1, 0, false, help_url);
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, BTN_QR_DISPLAY_EXIT, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_QR_DISPLAY_EXIT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_DISPLAY_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_QR_DISPLAY_EXIT) {
// Done
break;
@@ -1514,16 +1473,8 @@ void await_qr_help_activity(const char* url)
// Show, and await button click
while (true) {
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_QR_HELP_EXIT;
-#endif
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_QR_HELP_EXIT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_QR_BRIGHTNESS) {
gui_next_qrcode_color();
gui_repaint(act->root_node);
@@ -1555,16 +1506,8 @@ bool await_qr_back_continue_activity(
// Show, and await button click
while (true) {
- int32_t ev_id;
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, NULL, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_YES;
-#endif
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_YES);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
if (ev_id == BTN_QR_BRIGHTNESS) {
gui_next_qrcode_color();
gui_repaint(act->root_node);
diff --git a/main/ui/confirm_address.c b/main/ui/confirm_address.c
index 0c0dd35..2831009 100644
--- a/main/ui/confirm_address.c
+++ b/main/ui/confirm_address.c
@@ -168,22 +168,12 @@ bool show_confirm_address_activity(const char* address, const bool default_selec
= make_display_address_activities("Verify Address", show_tick, address, default_selection, &act_addr2);
gui_activity_t* act = act_addr1;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_ADDRESS_ACCEPT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_ADDRESS_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_addr1;
diff --git a/main/ui/descriptor.c b/main/ui/descriptor.c
index 9928292..64db924 100644
--- a/main/ui/descriptor.c
+++ b/main/ui/descriptor.c
@@ -166,22 +166,12 @@ bool show_view_descriptor_activity(const char* descriptor_name, const descriptor
gui_activity_t* act = act_summary;
uint8_t script_screen_index = 0;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_DESCRIPTOR_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_DESCRIPTOR_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
JADE_ASSERT(script_screen_index < num_script_screens);
@@ -273,22 +263,12 @@ static bool show_final_descriptor_summary_activity(
gui_activity_t* act_summary
= make_final_descriptor_summary_activities(descriptor_name, initial_confirmation, overwriting, &act_name);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_DESCRIPTOR_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_DESCRIPTOR_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
diff --git a/main/ui/dialogs.c b/main/ui/dialogs.c
index e9d437b..756869e 100644
--- a/main/ui/dialogs.c
+++ b/main/ui/dialogs.c
@@ -441,21 +441,11 @@ static bool await_yesno_activity_loop(gui_activity_t* const act, const char* hel
JADE_ASSERT(act);
// help_url is optional (but should be present if a BTN_HELP btn is present)
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'Yes' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_YES;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_YES);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
// Return true if 'Yes' was pressed, false if 'No'
switch (ev_id) {
case BTN_YES:
diff --git a/main/ui/multisig.c b/main/ui/multisig.c
index f0d7a72..9492745 100644
--- a/main/ui/multisig.c
+++ b/main/ui/multisig.c
@@ -161,22 +161,12 @@ static bool show_view_multisig_activity(const char* multisig_name, const bool in
= make_view_multisig_activities(multisig_name, initial_confirmation, is_valid, is_sorted, threshold,
num_signers, make_empty_none(blindingkeystr), &act_name, &act_type, &act_sorted, &act_blindingkey);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_MULTISIG_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_MULTISIG_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
@@ -305,22 +295,12 @@ static bool show_final_multisig_summary_activity(const char* multisig_name, cons
gui_activity_t* act_summary = make_final_multisig_summary_activities(multisig_name, threshold, num_signers,
num_signer_details, initial_confirmation, overwriting, &act_name, &act_type);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_MULTISIG_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_MULTISIG_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
diff --git a/main/ui/ota.c b/main/ui/ota.c
index e07c6b4..ea7cb7d 100644
--- a/main/ui/ota.c
+++ b/main/ui/ota.c
@@ -106,21 +106,12 @@ bool show_ota_versions_activity(
current_version, new_version, hashstr, full_fw_hash, &act_currentver, &act_newver, &act_hash);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_OTA_ACCEPT;
-#endif
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_OTA_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
diff --git a/main/ui/otpauth.c b/main/ui/otpauth.c
index 4fc653b..5190f80 100644
--- a/main/ui/otpauth.c
+++ b/main/ui/otpauth.c
@@ -179,22 +179,12 @@ bool show_otp_details_activity(
ctx, initial_confirmation, is_valid, show_delete_btn, &act_name, &act_label, &act_issuer, &act_type);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_OTP_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_OTP_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
diff --git a/main/ui/sign_identity.c b/main/ui/sign_identity.c
index e8a3ed2..d8bcb4c 100644
--- a/main/ui/sign_identity.c
+++ b/main/ui/sign_identity.c
@@ -34,21 +34,10 @@ bool show_sign_identity_activity(const char* identity, const size_t identity_len
gui_activity_t* const act = make_sign_identity_activity(display_str);
gui_set_current_activity(act);
- int32_t ev_id;
while (true) {
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_SIGNIDENTITY_ACCEPT;
-#endif
-
- // Check to see whether user accepted or declined
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNIDENTITY_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_SIGNIDENTITY_REJECT:
return false;
diff --git a/main/ui/sign_message.c b/main/ui/sign_message.c
index 675fef6..c064b6c 100644
--- a/main/ui/sign_message.c
+++ b/main/ui/sign_message.c
@@ -144,22 +144,12 @@ bool show_sign_message_activity(const char* message, const char* hashhex, const
= make_sign_message_activities(message, hashstr, pathstr, &act_message1, &act_message2, &act_hash, &act_path);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_SIGNMSG_ACCEPT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNMSG_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = (act == act_message2) ? act_message1 : act_summary;
diff --git a/main/ui/sign_tx.c b/main/ui/sign_tx.c
index ef1aa84..3c78b01 100644
--- a/main/ui/sign_tx.c
+++ b/main/ui/sign_tx.c
@@ -354,22 +354,12 @@ static bool show_input_output_activity(const char* title, const bool is_wallet_o
amount, ticker, issuer, assethex, warning_msg, &act_tickeramt, &act_addr1, &act_addr2, &act_assetinfo1,
&act_assetinfo2, &act_warning);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_SIGNTX_ACCEPT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNTX_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = (act == act_addr2) ? act_addr1 : act_summary;
@@ -725,22 +715,12 @@ static bool show_final_confirmation_activity(
gui_activity_t* const act_summary
= make_final_confirmation_activities(title, feeamount, ticker, warning_msg, &act_feeamt, &act_warning);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_SIGNTX_ACCEPT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNTX_ACCEPT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
diff --git a/main/ui/signer.c b/main/ui/signer.c
index 913abca..473253c 100644
--- a/main/ui/signer.c
+++ b/main/ui/signer.c
@@ -171,22 +171,12 @@ bool show_signer_activity(
gui_activity_t* act_summary = make_signer_activities(signer, signer_number, num_signers, is_this_signer,
&act_fingerprint, &act_derivation, &act_xpub1, &act_xpub2, &act_path);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'next' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_SIGNER_NEXT;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_SIGNER_NEXT);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = (act == act_xpub2) ? act_xpub1 : act_summary;
diff --git a/main/ui/update_pinserver.c b/main/ui/update_pinserver.c
index 663a262..46f649c 100644
--- a/main/ui/update_pinserver.c
+++ b/main/ui/update_pinserver.c
@@ -119,22 +119,12 @@ bool show_pinserver_details_activity(
make_empty_none(display_hex), initial_confirmation, &act_urlA, &act_urlB, &act_pubkey);
gui_activity_t* act = act_summary;
- int32_t ev_id;
while (true) {
gui_set_current_activity(act);
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_PINSERVER_DETAILS_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_PINSERVER_DETAILS_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_BACK:
act = act_summary;
@@ -221,20 +211,10 @@ bool show_pinserver_certificate_activity(const char* cert_hash_hex, const bool i
gui_activity_t* act = make_show_pinserver_certificate_activity(make_empty_none(display_hex), initial_confirmation);
gui_set_current_activity(act);
- int32_t ev_id;
while (true) {
- // In a debug unattended ci build, assume 'accept' button pressed after a short delay
-#ifndef CONFIG_DEBUG_UNATTENDED_CI
- const bool ret = gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL, 0);
-#else
- gui_activity_wait_event(act, GUI_BUTTON_EVENT, ESP_EVENT_ANY_ID, NULL, &ev_id, NULL,
- CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS / portTICK_PERIOD_MS);
- const bool ret = true;
- ev_id = BTN_PINSERVER_DETAILS_RETAIN_CONFIRM;
-#endif
-
- if (ret) {
+ const int32_t ev_id = gui_activity_wait_button(act, BTN_PINSERVER_DETAILS_RETAIN_CONFIRM);
+ if (ev_id != BTN_EVENT_TIMEOUT) {
switch (ev_id) {
case BTN_PINSERVER_DETAILS_DISCARD_DELETE:
return false;
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.