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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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.

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.

2 participants