Search code examples
ioslinuxbluetoothbluetooth-lowenergybluez

How to Set Linux BlueZ 5 Connection Parameters for Apple iOS Compatibility


I am seeing unreliable BLE connections between my Bluez 5.41 GATT Server on Linux and my iPhone. Connections work but sometimes disconnects randomly happen.

Apple has a document that specifies the optimimum set of connection parameters required to maintain a good / reliable connection:

https://developer.apple.com/library/content/qa/qa1931/_index.html

Specifically it refers to the following parameters:

There are certain rules and formulae that the parameters must follow. If the parameters do not comply with all of these rules, the parameter request may be rejected, or the stability and the performance of the connection may be compromised.

Interval Min ≥ 15 ms (multiples of 15 ms)
Interval Min + 15 ms ≤ Interval Max (Interval Max == 15 ms is allowed)
Interval Max * (Slave Latency + 1) ≤ 2 seconds
Interval Max * (Slave Latency + 1) * 3 < connSupervisionTimeout
Slave Latency ≤ 30
2 seconds ≤ connSupervisionTimeout ≤ 6 seconds

How do I set these on Linux for BlueZ ( hcitool / hciconfig ? ).


Solution

  • The linux kernel exposes many experimental/advanced attributes in /sys/kernel/debug/bluetooth/hci* as ordinary files.