Skip to content

pb-service: get a Bluetooth hub's name from bleak, not its GATT - #11

Merged
dlech merged 2 commits into
mainfrom
pb-service-ble-name
Oct 24, 2026
Merged

dlech merged 2 commits into
mainfrom
pb-service-ble-name

Conversation

@dlech

@dlech dlech commented Oct 24, 2026

Copy link
Copy Markdown
Member

Connecting to any hub over Bluetooth on macOS fails in the handshake with BleakCharacteristicNotFoundError for 0x2A00. CoreBluetooth keeps the Generic Access service to itself, so the Device Name characteristic is never among the services bleak sees.

HubLink gains read_name():

  • Bluetooth: BleakClient.name, which asks the OS for the name it already has. We already require bleak >= 1.1, which is when it was added.
  • USB and RFCOMM: still a read of 0x2A00 over the wire protocol, which the hub answers itself.

Tested on macOS with an Inventor hub: pb connect --transport ble fails on main with the error in the issue, and connects with this change.

Fixes pybricks/support#2870

Connecting to any hub over Bluetooth on macOS failed in the handshake
with BleakCharacteristicNotFoundError for 0x2A00. CoreBluetooth keeps the
Generic Access service to itself, so the Device Name characteristic is
never among the services bleak sees.

HubLink gains read_name(). Over Bluetooth it is BleakClient.name, which
asks the OS for the name it already has, from that characteristic or the
advertisement. Over USB and RFCOMM it is still a read of 0x2A00, which
the hub answers itself, so no OS stands in the way.

Reproduced with an Inventor hub on macOS before this change, and the same
hub connects after it.

Fixes: pybricks/support#2870
@dlech
dlech requested a balanced review from Copilot October 24, 2026 17:40

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

…ristic

The fake hub no longer serves 0x2A00, as macOS will not let it be read,
so a handshake that goes back to reading it fails here rather than only
on a Mac. Before, it served the name and every test passed either way.

Also simpler wording for the comment on read_name and the changelog.
@dlech
dlech merged commit ed64689 into main Oct 24, 2026
23 checks passed
@dlech
dlech deleted the pb-service-ble-name branch October 24, 2026 17:54
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.

[Bug] Running pybricksdev on TechnicHub and getting BleakCharacteristicNotFoundError: Characteristic 6e400003-b5a3

2 participants