Bluetooth on Linux
Install BlueZ package version 5.66 or higher. The BlueZ package is the official Linux stack and provides all the modules you’ll need to enable data sync with Bluetooth Low Energy (LE).
Add support for Linux to iOS connections.
BlueZ 5.51 and above try to automatically read the battery status/service of devices when they connect. However, iOS devices will default prevent BlueZ services from reading the battery service. As a result, BlueZ connection attempts will cause iOS devices to show a pairing prompt constantly. Therefore, we must disable the battery service in BlueZ using the following steps.
-
With your favorite editor, open the bluetooth service file. On Raspberry Pi OS it’s located: /usr/lib/systemd/system/bluetooth.service, on other versions it may be here: /etc/systemd/system/bluetooth.target.wants/bluetooth.service. You will probably need to use su permission to write to this file.
-
Find the line beginning with ExecStart= and add -P battery to the end. Now the line should look like this:
3. Save the file
4. Run sudo systemctl daemon-reload
and sudo systemctl restart bluetooth
to apply changes to the Bluetooth service.
5. By default, connections between dual-mode devices will use bredr
mode, which is not supported for BLE communication between Linux and macOS. To address this, configure BlueZ
to operate in LE mode by modifying the configuration file: /etc/bluetooth/main.conf
. Add or uncomment in the [General] section to change the setting:
After that, BlueZ should be able to connect to iOS devices without prompting and Ditto Apps should be able to communicate over BT-LE between iOS and Linux.