Repository navigation
pb-service: keep the spaces that belong to a hub's name - #7
Merged
Merged
Conversation
The firmware builds its Bluetooth name as the hub's name, one space and "(MINDSTORMS EV3)" or "(MINDSTORMS NXT)" (pbsys_host_get_hub_display_name). Taking the type off stripped every space around the name, so a hub named " Bumblebee " was listed as "Bumblebee", and a name filter, which matches exactly, could not find it. Only the one separating space goes now.
dlech
force-pushed
the
rfcomm-hub-name-spaces
branch
from
October 18, 2026 16:04
805ad45 to
b7be025
Compare
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves name whitespace and includes regression coverage, with no unresolved findings.
No open issues 🎉
What changed in this PR
Preserves spaces belonging to RFCOMM hub names so discovery names remain compatible with exact-name filters.
Changes:
- Removes only the firmware’s single separating space before the hub-type suffix.
- Adds regression coverage for leading and trailing spaces in a hub name.
| File | Description |
|---|---|
| packages/pb-service/tests/test_rfcomm_naming.py | Tests preservation of spaces in hub names. |
| packages/pb-service/src/pb_service/hub/rfcomm/port.py | Replaces whitespace stripping with single-space suffix removal. |
Review effort: Balanced
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.
Stacked on #6, which adds
split_hub_name. GitHub will retarget this tomainwhen #6 merges.The firmware builds a hub's Bluetooth name as its own name, one space, then
(MINDSTORMS EV3)or(MINDSTORMS NXT). That'spbsys_host_get_hub_display_namein pybricks-micropython'slib/pbio/sys/host.c.split_hub_nametook the type off withstrip(), which also removed spaces belonging to the name itself. So a hub named" Bumblebee "was listed as"Bumblebee", while the hub reports its name with the spaces, and a name filter, which matches exactly, could not find it.Now only the one separating space is removed. A new test case covers a name with leading and trailing spaces.
Found by Copilot's review of #6.