-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
drv/bluetooth/stm32_cc2640: send correct max size #229
Conversation
This finishes a TODO in the CC2640 driver to send the correct max payload size to the host via the Pybricks hub capabilities characteristic. Previously, this was hardcoded to use the hub max MTU size. But some Bluetooth adapters have a smaller MTU size, so we need to use the smaller of the two. Fixes: pybricks/support#947
If a host tries to write more than MTU - 3 bytes to an attribute, the host should do a prepared write to split up the write into multiple long writes. We currently don't support this. So we need to send an error response to the prepared write request. The host may also follow this with an execute write command to cancel the prepared write, so we need to respond to that too. Issue: pybricks/support#947
Thanks! Is this expected to have any side effects at all or would it only affect the Pybricks Code connection on the affected hosts? In order words, any platforms this should be extensively tested on? Otherwise happy to just merge. |
The changes are quite minimal so I feel like we have done adequate testing. The only behavior change will be for hosts that report an MTU less than 158. And we have verified that case is working as expected now since it was previously broken. |
|
||
attExchangeMTURsp_t rsp; | ||
rsp.serverRxMTU = PBDRV_BLUETOOTH_MAX_MTU_SIZE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why does this response not use the conn_mtu
value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the Bluetooth spec, both the central and peripheral send their own value and take the lesser of the two. This way, it doesn't matter who asks first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! If you have time at some point, I have a few more Bluetooth questions 😄
This finishes a TODO in the CC2640 driver to send the correct max payload size to the host via the Pybricks hub capabilities characteristic. Previously, this was hardcoded to use the hub max MTU size. But some Bluetooth adapters have a smaller MTU size, so we need to use the smaller of the two.
Fixes: pybricks/support#947