Skip to content

UI shows 'undefined' instead of the real WASM error; BLE connect type is non-functional #4

Description

@denny4-user

Two usability issues found while debugging .rpk installation on a Xiaomi Smart Band 10 Pro (M2552B1, global FW 3.201.016) in Chrome on macOS. BandBurg itself works well — the connection, device info and watchface list are all fine.

1. All WASM errors surface in the UI as undefined

The operation log only ever shows:

文件安装失败: xxx.rpk - 调用 miwear_install 失败: undefined

But the DevTools console has the actual reason:

wasm-client.js:329  调用WASM命令 miwear_install 失败: invalid watchface id
wasm-client.js:330  错误详情: undefined

wasm-client.js:329  调用WASM命令 miwear_install 失败:
    watchface install failed: InstallFailed [modules\core\src\device\xiaomi\components\install.rs:340]

Those messages are precise and immediately actionable; undefined is not. The cause looks like the UI reading error.stack (undefined for values thrown from WASM) or error.message instead of the error value itself — note that line 330 already prints 错误详情: undefined for the same reason.

Suggestion: in the catch path, fall back to String(error) / error.toString() when message/stack are absent, and surface that in the operation log.

I spent several hours attributing undefined to hardware/connection problems when the WASM had been telling the truth all along.

2. The BLE option in 连接类型 does nothing

src/App.tsx offers:

<option value="SPP">SPP</option>
<option value="BLE">BLE</option>

but the bundled astrobox_ng_wasm.js contains no Web Bluetooth calls at all:

navigator.bluetooth / requestDevice / getPrimaryService  →  0 occurrences
requestPort / SerialPort                                  →  6 occurrences

wasm-client.js:228 also defaults to args.connect_type || 'SPP'. Selecting BLE still goes through navigator.serial.requestPort(), so on platforms where the band exposes no serial port the connection fails with Failed to execute 'requestPort' on 'Serial' regardless of the choice.

Suggestion: hide or disable the BLE option until the WASM build implements it, or note in the UI that only SPP is supported in the browser build.

Platform note that may help other macOS users

macOS only creates /dev/cu.XiaomiSmartBand10Pro9D83 after the band has been freshly paired via Settings → Connect new phone. Before that the Serial chooser is empty and the connection cannot be established — this is easy to mistake for a BandBurg bug. Chrome additionally logs Chooser dialog is not displaying a port blocked by the Serial blocklist for the band's other Bluetooth service UUIDs, which is expected noise.

Environment: Chrome 150, macOS 15, Smart Band 10 Pro M2552B1 FW 3.201.016, SPP.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions