Skip to content

Bluetooth: log in to a REPL with a password before sending anything - #23

Merged
bdbarnett merged 1 commit into
mainfrom
fix/ble-login
Oct 29, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
fix/ble-login

Conversation

@bdbarnett

Copy link
Copy Markdown

Connecting over Web Bluetooth to a board whose REPL has a password (bledev.repl, like WebREPL) looped on "Access denied".

The board takes the first line it receives as the password. Workbench's first write was its REPL probe ( \r), so every connection began with a wrong password. Now the transport sends an empty line first and waits up to 1.5 s for an answer. If the board answers Password:, Workbench asks for the password (remembered for reconnects, as for WebREPL) and sends it before anything else. A board without a password, a busy one, or one still pairing goes on as before.

test/suites/bluetooth_login.js fakes the board at the GATT level: the password goes out before anything else, a wrong password is reported, a board without a password is never asked, and a silent board doesn't hold up the connection. Three of the four fail against the old transport. Tried in Chrome on Android against an ESP32-S3 board, with a password and with passkey pairing: both reach a working prompt.

Fixes #22

A password-protected Bluetooth REPL takes the first line it's sent as the
password, so the probe Workbench sent on connect counted as a wrong one and
the board answered Access denied on every reconnect. Connecting now asks
with an empty line, and if the board answers Password:, prompts for it and
sends it first.

Fixes #22
@bdbarnett
bdbarnett merged commit 3c70973 into main Oct 29, 2026
1 check passed
@bdbarnett
bdbarnett deleted the fix/ble-login branch October 29, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Bluetooth can't log in to a board's password-protected Bluetooth REPL

1 participant