Skip to content

Commit 3f445ff

Browse files
wabicaiclaude
andcommitted
debug: add main.py boot/usb diagnostic prints
Add prints before/after boot import, usb import, usb.bus.open, and StatusBar to pinpoint where execution stalls — ConnectionRefusedError indicates usb.bus.open() is never reached. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fdb862a commit 3f445ff

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

test/data/onekey-firmware-build.patch

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,36 @@ index 2bf17e049..8d0540bde 100644
256256

257257
def store_ble_name(ble_name):
258258
diff --git a/core/src/main.py b/core/src/main.py
259-
index 511b4fe43..5d598f1b8 100644
259+
index 511b4fe43..53f38e1c2 100644
260260
--- a/core/src/main.py
261261
+++ b/core/src/main.py
262-
@@ -51,7 +51,6 @@ import usb # noqa: F401
262+
@@ -39,21 +39,25 @@ import trezor.pin # noqa: F401
263+
unimport_manager = utils.unimport()
264+
265+
# unlock the device, unload the boot module afterwards
266+
+print("DBG main: before boot import")
267+
with unimport_manager:
268+
import boot
269+
del boot
270+
+print("DBG main: boot done")
271+
272+
# === Prepare the USB interfaces first. Do not connect to the host yet.
273+
# usb imports trezor.utils and trezor.io which is a C module
274+
import usb # noqa: F401
275+
+print("DBG main: usb imported")
276+
277+
# start the USB
263278
import storage.device
264279
usb.bus.open(storage.device.get_device_id())
265-
266280
-
281+
+print("DBG main: usb.bus.open done")
282+
267283
# initialize the status bar
268284
StatusBar.get_instance()
285+
+print("DBG main: StatusBar done, entering loop")
269286

287+
# run the endless loop
288+
while True:
270289
diff --git a/core/src/session.py b/core/src/session.py
271290
index 1fb029830..b3e5960b0 100644
272291
--- a/core/src/session.py

0 commit comments

Comments
 (0)