IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.59k stars 491 forks source link

Handle MTU request from peripheral #408

Closed csonsino closed 4 years ago

csonsino commented 4 years ago

There are peripherals that initiate an MTU exchange request, but currently bluepy rejects the request and sends a not supported response.

These changes update the bluepy-helper to register for and handle the ATT_OP_MTU_REQ event. Additional changes were made to btle.py track the MTU and add the ability the to get the current value.

mdxs commented 4 years ago

This would be great to see incorporated into bluepy as currently I actually need to segment some transfers and the subsequent overhead is slowing down the overall process.

Fear I cannot comment on the bluepy/bluepy-helper.c changes in detail... as I've not worked with this myself; but wouldn't it be expected that there is a default MTU of 23 bytes? I don't seem to spot that in the code of this PR, but as said: noob here.