Open
Conversation
Author
|
Added follow-up updates in 7f1b7be:
Validation:
There is still no public OneKey emulator for CI end-to-end flows, so device-flow verification remains manual for now. |
This was referenced Feb 26, 2026
Author
|
@achow101 could you review this PR? |
Author
|
@Sjors Could you take a look for this PR? |
Member
|
A simulator/emulator is required for new devices, and must be tested via CI. |
3f445ff to
cbf86fe
Compare
Ari4ka
approved these changes
Mar 20, 2026
Ari4ka
approved these changes
Mar 20, 2026
Author
I have already integrated the simulator and other components in my local repository. Please review again. |
Ari4ka
approved these changes
Mar 22, 2026
Add OneKey device support to HWI, covering all OneKey models (Pro, Classic, Classic 1S, Mini, Touch, Pure). - hwilib/devices/onekey.py: Full HWI device interface including enumerate, get_pubkey_at_path, get_master_xpub, sign_tx, sign_message, display_singlesig/multisig_address, setup/wipe/restore - hwilib/devices/onekeylib/: OneKey-specific client library with protocol profiles, DebugLink support, transport layer, and feature detection per model - hwilib/udev/51-usb-onekey.rules: Linux udev rules for OneKey USB - docs/devices/index.rst: Documentation reference
24 test cases per model covering enumerate, fingerprint detection, getdescriptors, getkeypool, signtx (single + multisig), displayaddress (single + multisig + descriptor), signmessage, getxpub, and label. OneKey Pro emulator patch (onekey-pro-firmware-build.patch): - Skip boot_animation + lvgl_tick in emulator (direct config.unlock) - StatusBar stub to avoid LVGL widget creation crashes - _emu_confirm() guards on UI confirm functions (confirm_output, confirm_total, confirm_signverify, confirm_action, confirm_blob, show_address, show_popup, etc.) to skip LVGL screen creation - Simplified dispatch_debuglink_decision for LVGL compatibility - loop.close() cleanup fix for _paused dict entries OneKey Classic 1S emulator patch (onekey-classic1s-emulator.patch): - DebugLink button_request fix for address display flow - Emulator guards for layoutSignMessage and fsm_layoutAddress - cryptoMultisigPubkeyIndex leaf pubkey fallback - signing_sign_ecdsa hdnode_fill_public_key fix Test infrastructure: - SIGALRM-based 30s PINGPING timeout for reliable emulator startup - supports_idle_auto_press=True for Pro DebugLink auto-confirm - ONEKEY_UDP_PORT environment variable for emulator communication
- sim-builder-onekey: builds both Pro and Classic 1S emulators - test-onekey-pro: 24 test jobs (4 Python versions × 6 interfaces) - test-onekey-classic1s: 24 test jobs - install-sim: Xvfb setup for Pro's SDL display, apt dependencies - sim-build-map: onekey-pro and onekey-classic1s archive definitions - prepare-sim-matrices: onekey family matrix generation - device-test: 60-minute timeout for OneKey Pro (comparable to Trezor T)
cf144b9 to
09e7ba4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds native OneKey support to HWI and wires it into simulator-backed tests/CI.
Compared with the original revision, the current implementation no longer tries to extend the generic
trezorlib.clientlogic directly. Instead, OneKey-specific behavior is isolated on the OneKey side inhwilib.devices.onekeyandhwilib.devices.onekeylib.Main changes:
hwilib.devices.onekeyas the HWI entrypoint for OneKey deviceshwilib.devices.onekeylib/*to keep OneKey-specific model/profile/transport/client compatibility logic out of generic Trezor codetrezor.enumerate()so Trezor enumeration is not pollutedReviewer Guide
If you want to review this efficiently, the main areas are:
hwilib/devices/onekey.pyhwilib/devices/onekeylib/protocol.pyhwilib/devices/onekeylib/features.pyhwilib/devices/onekeylib/transport.pyhwilib/devices/onekeylib/client.pyWhat to check:
test/test_onekey.pytest/run_tests.pytest/setup_environment.shtest/data/onekey-firmware-build.patchtest/data/onekey-classic1s-emulator.patchWhat to check:
.github/actions/build-sim/action.yml.github/actions/install-sim/action.yml.github/sim-build-map.json.github/workflows/ci.yml.github/workflows/device-test.yml.github/workflows/prepare-sim-matrices.ymlWhat to check:
Firmware Snapshots Used By CI
To keep CI reproducible, simulator builds use pinned firmware snapshots:
3bb8767e55f88005830880d4f797e91d4077ee01ee01f0114fd18dbdf3da3ee8de5dec9b391f1bc8The HWI test harness currently applies two local patches when building these snapshots:
test/data/onekey-firmware-build.patchtest/data/onekey-classic1s-emulator.patchThese patches are there to make the current pinned emulator builds reliable under automated HWI tests and CI packaging. They are not intended as production firmware changes.
Validation
Local validation completed for the current revision:
python -m unittest test_onekey-> passed (Ran 14 tests,OK)test/run_tests.py --onekey-classic1s --interface=library --device-only-> passed (Ran 24 tests,OK)library,cli, andstdinlibrary,cli, andstdinSmoke coverage included at least:
enumerategetmasterxpubNotes