Skip to content

fix: support Pro2 and Neo BLE flows - #877

Open
wabicai wants to merge 14 commits into
onekeyfrom
fix/pro2-neo-ble-find-my
Open

fix: support Pro2 and Neo BLE flows#877
wabicai wants to merge 14 commits into
onekeyfrom
fix/pro2-neo-ble-find-my

Conversation

@wabicai

@wabicai wabicai commented Aug 13, 2026

Copy link
Copy Markdown
Member

Summary

  • recognize Neo BLE names during SDK discovery
  • normalize Pro2 Find My advertisement suffixes while preserving the BLE peripheral ID
  • surface the Protocol V2 USB-priority response as BleUnavailableWhileUsbConnected (723) without resetting or retrying the BLE probe
  • update firmware-pro2 to dev 133389a08 and regenerate the corrected TON signing_message field
  • document the observed Pro2 Find My and Neo advertisement formats

Why

A Find My-bound Pro2 can advertise as Pro2 22D8 - Find My, while connected device information may contain a truncated suffix. The matcher tolerates spacing, separator, and capitalization variations without requiring one exact suffix string, and the SDK displays the original Pro2 22D8 name.

Neo advertises as Neo followed by its four-character suffix. Both products use the same Protocol V2 discovery and communication path.

When USB owns the firmware link, Pro2 and Neo answer the BLE Protocol V2 Ping with Failure_ProcessError (5), message link disabled. This is expected USB-priority arbitration, not a busy command queue or broken BLE link. The SDK now returns code 723 immediately and preserves the firmware failure details; it does not reset or retry the probe.

The updated Protocol V2 firmware schema corrects TON field 2 from signning_message to signing_message. Pro2 and Neo do not retain compatibility with the old Protocol V2 spelling. Core continues accepting signning_message only for the already released Pro/Protocol V1 response schema.

Physical-device verification

  • raw Pro2 22D8 advertisement: Pro2 22D8 - Find My; SDK search displays Pro2 22D8
  • Pro2 22D8 Protocol V2 request and response succeeded
  • Neo advertisements are recognized and preserve the Neo display name
  • genuine Neo 47B9 strict Protocol V2 Ping, DeviceInfo, and ProtocolInfo succeeded
  • Neo USB-owned link disabled response is treated as the expected terminal USB-priority error

App integration review

app-monorepo already treats Pro2 and Neo as the same Protocol V2 product family for device settings. After DeviceSettingsSet, the SDK reloads DeviceSettings and emits DEVICE.STATE; the App background runtime waits for DB persistence and then notifies the main runtime. No duplicate App-side settings write was added.

The App consumes code 723 and uses its existing localized “unplug USB and retry” guidance. It no longer infers this condition from arbitrary error message text.

Validation

  • yarn agent:check --profile commit
  • focused Protocol V2 probe tests: 58 passed
  • focused shared error contract tests: 23 passed
  • focused Core device settings and TON tests: 30 passed
  • protobuf schema tests: 16 passed
  • focused App BLE conflict and synchronization tests: 64 passed
  • hd-transport, hd-shared, and hd-core builds
  • changed-file ESLint and git diff --check

Notes

The existing SDK cancel(connectId?) API already covers Pro2 and Neo calls; no duplicate cancellation path is introduced. The SDK packages were published as 1.2.0-alpha.124 with npm dist-tag next.

Comment thread packages/shared/src/constants.ts Fixed
Comment thread packages/shared/src/constants.ts Fixed
@wabicai wabicai changed the title fix: support Pro2 and Neo BLE discovery fix: support Pro2 and Neo BLE flows Aug 14, 2026
@wabicai
wabicai marked this pull request as ready for review August 14, 2026 12:23
@sidmorizon

Copy link
Copy Markdown
Contributor

@codex review

@sidmorizon

Copy link
Copy Markdown
Contributor

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d42192d803

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/core/src/core/index.ts
Comment thread packages/hd-transport-react-native/src/index.ts
Comment thread packages/hd-transport/src/protocols/v2/session.ts
Comment thread packages/hd-transport/src/protocols/v2/session.ts
Comment thread packages/shared/src/constants.ts

@originalix originalix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One additional inline correctness finding.

typeof firmwareMessage === 'string' &&
firmwareMessage.trim().toLowerCase() === 'link disabled'
) {
throw createProtocolV2LinkDisabledError(failureCode, firmwareMessage);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Normalize this failure for established Protocol V2 sessions too

This conversion only runs during protocol probing. If the BLE session is already established and USB subsequently takes ownership, the same Failure_ProcessError / exact link disabled response goes through DeviceCommands' common Failure handling and falls through to HardwareErrorCode.RuntimeError (800), so callers still never receive 723. This affects ordinary commands such as device-state and portfolio-sync requests, not only connection setup.

Please centralize the exact code/message predicate and reuse it in both probeProtocolV2() and the normal DeviceCommands Failure mapper, then add an established-session test that asserts the public error is BleUnavailableWhileUsbConnected (723). This is separate from preserving the probe sentinel through DeviceConnector.acquire().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已按这个建议做了。

isProtocolV2LinkDisabledFailure() 抽到 hd-transport/src/protocols/v2/errors.tsprobeProtocolV2()DeviceCommands 的 Failure 映射共用。已建立的 V2 session 再收到 Failure_ProcessError / 5 + link disabled,也会直接变成 723,不再掉进 RuntimeError (800)。

测试:

  • packages/core/__tests__/DeviceCommands.test.ts(含 numeric 5
  • packages/hd-transport/__tests__/protocol-v2.test.js

@wabicai

wabicai commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

Review 意见已在 1.2.0-alpha.126319e13c7a)处理完,对应 thread 也回过了:

  • acquire 路径会保留 723,不再被 safeThrowError 吃成 UnknownError / DeviceNotFound
  • 已建立的 V2 session 同样在 DeviceCommands 映射 link disabled → 723
  • lowlevel / RN / Electron BLE 的 acquire 失败会清掉半开连接
  • Find My 识别和展示名剥离拆开,自定义名不会再被当成钱包端点

Comment thread packages/core/src/device/DeviceCommands.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants