Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ble): enforce maximum length for dynamic device name #2784

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

xudongzheng
Copy link
Contributor

No description provided.

@@ -238,6 +238,11 @@ config BT_PERIPHERAL_PREF_LATENCY
config BT_PERIPHERAL_PREF_TIMEOUT
default 400

# The device name should be 16 characters or less so it fits within the
# advertising data.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be configurable? The comment implies that the value should always be 16.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the value should not be changed. I didn't calculate the value myself but it should be the maximum Bluetooth advertising payload length minus everything in zmk_ble_ad.

It's getting set here so bt_set_name() and zmk_ble_set_device_name() return an error if the length is exceeded.

Copy link
Contributor

@petejohanson petejohanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good catch!

@petejohanson petejohanson merged commit ea267b0 into zmkfirmware:main Feb 26, 2025
48 checks passed
@xudongzheng xudongzheng deleted the bt-dynamic-len-pr branch February 26, 2025 20:24
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.

3 participants