IanHarvey / bluepy

Python interface to Bluetooth LE on Linux
Other
1.58k stars 490 forks source link

Fix MTU negotiation logic. Resolves notification data truncation. #510

Open retsyx opened 2 months ago

retsyx commented 2 months ago

MTU for client and server can be different. When we negotiate MTU, don't use the returned server's MTU for our client's MTU. Instead, set our MTU, notify the server, and be done.

The server correctly uses our max advertised MTU when sending us data. However, bluepy-helper MTU logic used the minimum of the advertised client and server MTUs to set the local MTU. So when the server advertised a smaller MTU, bluepy-helper truncated notification data that was longer than the server's smaller MTU.