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 bluetoothto apply changes to the Bluetooth service.
5. Linux’s Bluetooth system aggressively prefers classic Bluetooth (BR/EDR) mode when it encounters a Mac - this results in both the pairing popups and intermittent sync. Before running your app, you can prevent this with a little Bluetooth configuration on your Linux machines.
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.
Run the following command to set BlueZ’ support for multiple advertisements.
Was this page helpful?