change name of usb_connected() to usb_is_powered()
What changed, and why it matters
This commit is a simple rename of a function from usb_connected() to usb_is_powered() across 18 files. There are no logic changes, no security fixes, and no behavioral differences. It appears to be a code-clarity refactor to make the function's purpose clearer.
No action required. This is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit performs a global rename of the function usb_connected() to usb_is_powered(). All call sites and definitions are updated identically; no conditional logic, return values, or side effects are altered. The function continues to indicate whether USB power is detected, not whether a USB data connection is established. No security-relevant changes are present.
Changed components
main/gui.cmain/idletimer.cmain/power.hmain/power/ip5306.incmain/power/jadev10.incmain/power/jadev11.incmain/power/jadev20.incmain/power/m5stackcores3.incmain/power/m5stickcplus.incmain/power/m5stickcplus2.incmain/power/minimal.incmain/power/tdisplays3.incmain/power/twatchs3.incmain/power/wslcdtouch2.incmain/process.cmain/process/dashboard.cmain/usbhmsc/usbhmsc.cmain/usbhmsc/usbmode.cInspect captured patch +18 / −18
diff --git a/main/gui.c b/main/gui.c
index 1078744..cdffdb2 100644
--- a/main/gui.c
+++ b/main/gui.c
@@ -2191,7 +2191,7 @@ static bool update_status_bar(const bool force_redraw)
status_bar.updated = true;
}
- const bool new_usb = usb_connected();
+ const bool new_usb = usb_is_powered();
if (new_usb != status_bar.last_usb_val) {
status_bar.last_usb_val = new_usb;
if (new_usb) {
diff --git a/main/idletimer.c b/main/idletimer.c
index 789c434..0200601 100644
--- a/main/idletimer.c
+++ b/main/idletimer.c
@@ -133,7 +133,7 @@ static void idletimer_task(void* ignore)
if (!idle_timeout_disabled && (projected_timeout_time <= checktime)) {
// If usb is connected instead of deactivating we can reboot (if wallet loaded) and dim the screen
typedef enum { SCREEN_DIMMED, REBOOT, POWER_OFF } reset_action_t;
- reset_action_t action = !usb_connected() ? POWER_OFF : (keychain_get() ? REBOOT : SCREEN_DIMMED);
+ reset_action_t action = !usb_is_powered() ? POWER_OFF : (keychain_get() ? REBOOT : SCREEN_DIMMED);
JADE_LOGW("Idle-timeout elapsed - action: %u", action);
if (action != SCREEN_DIMMED) {
diff --git a/main/power.h b/main/power.h
index ab644aa..f94c9e7 100644
--- a/main/power.h
+++ b/main/power.h
@@ -31,7 +31,7 @@ uint16_t power_get_vusb(void);
uint16_t power_get_iusb(void);
uint16_t power_get_temp(void);
-bool usb_connected(void);
+bool usb_is_powered(void);
#ifdef CONFIG_IDF_TARGET_ESP32S3
void enable_usb_host(void);
diff --git a/main/power/ip5306.inc b/main/power/ip5306.inc
index 7e3fda6..07a7d31 100644
--- a/main/power/ip5306.inc
+++ b/main/power/ip5306.inc
@@ -86,7 +86,7 @@ uint16_t power_get_vusb(void) { return 0; }
uint16_t power_get_iusb(void) { return 0; }
uint16_t power_get_temp(void) { return 0; }
-bool usb_connected(void)
+bool usb_is_powered(void)
{
uint8_t chargedata, chargedata2;
JADE_SEMAPHORE_TAKE(i2c_mutex);
diff --git a/main/power/jadev10.inc b/main/power/jadev10.inc
index 2258b37..3a07023 100644
--- a/main/power/jadev10.inc
+++ b/main/power/jadev10.inc
@@ -205,7 +205,7 @@ uint16_t power_get_temp(void)
return temp;
}
-bool usb_connected(void)
+bool usb_is_powered(void)
{
uint8_t buf;
JADE_SEMAPHORE_TAKE(i2c_mutex);
diff --git a/main/power/jadev11.inc b/main/power/jadev11.inc
index c052762..1f10bd1 100644
--- a/main/power/jadev11.inc
+++ b/main/power/jadev11.inc
@@ -261,7 +261,7 @@ uint16_t power_get_temp(void)
return temp;
}
-bool usb_connected(void)
+bool usb_is_powered(void)
{
uint8_t buf;
JADE_SEMAPHORE_TAKE(i2c_mutex);
diff --git a/main/power/jadev20.inc b/main/power/jadev20.inc
index 6f7c190..f85610e 100644
--- a/main/power/jadev20.inc
+++ b/main/power/jadev20.inc
@@ -274,7 +274,7 @@ void enable_usb_host(void)
JADE_SEMAPHORE_GIVE(i2c_mutex);
}
-bool usb_connected(void)
+bool usb_is_powered(void)
{
uint8_t usb_type;
JADE_SEMAPHORE_TAKE(i2c_mutex);
diff --git a/main/power/m5stackcores3.inc b/main/power/m5stackcores3.inc
index a8bf583..449f57f 100644
--- a/main/power/m5stackcores3.inc
+++ b/main/power/m5stackcores3.inc
@@ -85,4 +85,4 @@ uint16_t power_get_iusb(void) { return 0; }
uint16_t power_get_temp(void) { return 0; }
-bool usb_connected(void) { return false; }
+bool usb_is_powered(void) { return false; }
diff --git a/main/power/m5stickcplus.inc b/main/power/m5stickcplus.inc
index 432556e..9ab26c2 100644
--- a/main/power/m5stickcplus.inc
+++ b/main/power/m5stickcplus.inc
@@ -361,7 +361,7 @@ uint16_t power_get_temp(void)
return temp;
}
-bool usb_connected(void)
+bool usb_is_powered(void)
{
uint8_t buf;
JADE_SEMAPHORE_TAKE(i2c_mutex);
diff --git a/main/power/m5stickcplus2.inc b/main/power/m5stickcplus2.inc
index d06404a..17c6f46 100644
--- a/main/power/m5stickcplus2.inc
+++ b/main/power/m5stickcplus2.inc
@@ -81,4 +81,4 @@ uint16_t power_get_vusb(void) { return 0; }
uint16_t power_get_iusb(void) { return 0; }
uint16_t power_get_temp(void) { return 0; }
-bool usb_connected(void) { return true; }
+bool usb_is_powered(void) { return true; }
diff --git a/main/power/minimal.inc b/main/power/minimal.inc
index d7814c2..ffee4d8 100644
--- a/main/power/minimal.inc
+++ b/main/power/minimal.inc
@@ -31,4 +31,4 @@ uint16_t power_get_temp(void) { return 0; }
void disable_usb_host(void) {}
void enable_usb_host(void) {}
-bool usb_connected(void) { return true; }
+bool usb_is_powered(void) { return true; }
diff --git a/main/power/tdisplays3.inc b/main/power/tdisplays3.inc
index 88b979f..dd28a46 100644
--- a/main/power/tdisplays3.inc
+++ b/main/power/tdisplays3.inc
@@ -84,7 +84,7 @@ uint16_t power_get_vusb(void) { return 0; }
uint16_t power_get_iusb(void) { return 0; }
uint16_t power_get_temp(void) { return 0; }
-bool usb_connected(void)
+bool usb_is_powered(void)
{
// If the voltage is greater than 4500 mV it means USB is connected
uint16_t vbat = power_get_vbat();
diff --git a/main/power/twatchs3.inc b/main/power/twatchs3.inc
index 1a47987..e7cbc65 100644
--- a/main/power/twatchs3.inc
+++ b/main/power/twatchs3.inc
@@ -108,4 +108,4 @@ uint16_t power_get_iusb(void) { return 0; }
uint16_t power_get_temp(void) { return 0; }
-bool usb_connected(void) { return false; }
+bool usb_is_powered(void) { return false; }
diff --git a/main/power/wslcdtouch2.inc b/main/power/wslcdtouch2.inc
index 6eafde2..bb5c88a 100644
--- a/main/power/wslcdtouch2.inc
+++ b/main/power/wslcdtouch2.inc
@@ -206,4 +206,4 @@ void disable_usb_host(void) {}
void enable_usb_host(void) {}
// This is only a guess by the ADC voltage when the USB is plugged in
-bool usb_connected(void) { return power_get_vbat() > 1350; }
+bool usb_is_powered(void) { return power_get_vbat() > 1350; }
diff --git a/main/process.c b/main/process.c
index b1df4d6..5ee05e1 100644
--- a/main/process.c
+++ b/main/process.c
@@ -398,7 +398,7 @@ void jade_process_get_in_message(void* ctx, inbound_message_reader_fn_t reader,
// NOTE: this check only really affects 'blocking' calls, as a non-blocking call is going
// to return 'no message' here in any case.
if (blocking && last_message_source != SOURCE_NONE) {
- const bool lost_usb_connection = (last_message_source == SOURCE_SERIAL) && !usb_connected();
+ const bool lost_usb_connection = (last_message_source == SOURCE_SERIAL) && !usb_is_powered();
const bool lost_ble_connection = (last_message_source == SOURCE_BLE) && !ble_connected();
if (lost_usb_connection || lost_ble_connection) {
JADE_LOGE("Lost connection, returning from blocking wait without fetching message");
diff --git a/main/process/dashboard.c b/main/process/dashboard.c
index 27dd903..7835c45 100644
--- a/main/process/dashboard.c
+++ b/main/process/dashboard.c
@@ -2637,7 +2637,7 @@ static void do_dashboard(jade_process_t* process, const keychain_t* const initia
// NOTE: only applies to a *peristed* keychain - ie if we have a pin set, and *NOT*
// if this is a temporary/emergency-restore wallet.
if (initial_has_pin && initial_keychain && !keychain_has_temporary()) {
- if ((initial_userdata == SOURCE_SERIAL && !tolerate_usb_disconnection && !usb_connected())
+ if ((initial_userdata == SOURCE_SERIAL && !tolerate_usb_disconnection && !usb_is_powered())
|| (initial_userdata == SOURCE_BLE && !ble_connected())) {
JADE_LOGI("Connection lost - clearing keychain");
keychain_clear();
diff --git a/main/usbhmsc/usbhmsc.c b/main/usbhmsc/usbhmsc.c
index 252895c..07c8707 100644
--- a/main/usbhmsc/usbhmsc.c
+++ b/main/usbhmsc/usbhmsc.c
@@ -286,7 +286,7 @@ bool usbstorage_start(void)
JADE_ASSERT(!main_task);
// Power any connected device
- JADE_ASSERT(!usb_connected());
+ JADE_ASSERT(!usb_is_powered());
enable_usb_host();
usbstorage_is_enabled = true;
diff --git a/main/usbhmsc/usbmode.c b/main/usbhmsc/usbmode.c
index d6a1e83..d146bbd 100644
--- a/main/usbhmsc/usbmode.c
+++ b/main/usbhmsc/usbmode.c
@@ -306,7 +306,7 @@ static bool handle_usbstorage_action(const char* title, usbstorage_action_fn_t u
JADE_ASSERT(usbstorage_action);
JADE_ASSERT(ctx);
- while (usb_connected()) {
+ while (usb_is_powered()) {
const char* message[] = { "Disconnect USB power and", "connect a storage device" };
if (!await_continueback_activity(title, message, 2, true, "blkstrm.com/jadeusbstorage")) {
return false;
Why this scored 15/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.