Repository navigation
pb-service: get a Bluetooth hub's name from bleak, not its GATT - #11
Merged
Merged
Conversation
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
…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.
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.
Connecting to any hub over Bluetooth on macOS fails in the handshake with
BleakCharacteristicNotFoundErrorfor 0x2A00. CoreBluetooth keeps the Generic Access service to itself, so the Device Name characteristic is never among the services bleak sees.HubLinkgainsread_name():BleakClient.name, which asks the OS for the name it already has. We already require bleak >= 1.1, which is when it was added.Tested on macOS with an Inventor hub:
pb connect --transport blefails onmainwith the error in the issue, and connects with this change.Fixes pybricks/support#2870