Reputation: 31
Im currently working on a Mobile application which connects to a Ble peripheral and reads data from it. In order to test if the connection is working. I have written a small C# application that utilizes the RaspberryPi4 bluetooth via DBus with BlueZ.
Everything works except that when connecting to iOS a pairing request is issued by the raspberry, eventhough I do not have any encrypted characteristics.
I have read on the Apple forum that this is because bluetoothd is automaticly trying to read the battery level of the phone. But sadly even after the fix suggested there I get the pairing requests.
Does anyone have an idea how I could fix this?
Thanks in advance
Upvotes: 1
Views: 729
Reputation: 1631
enter code here
> One cause of this is that Linux tries to read the battery state from
the iPhone, which triggers the pairing request. You can configure bluez to prevent this.
To disable auto Battery reading
Open the bluetooth service file /usr/lib/systemd/system/bluetooth.service
, or /etc/systemd/system/bluetooth.target.wants/bluetooth.service
in a text editor. You may need sudo permission to write to this file.
Add -P battery
to the end of the ExecStart line to disable the Battery feature in bluetoothd. Your ExecStart should look now something like ExecStart=/usr/lib/bluetooth/bluetoothd -P battery
. Save the file.
Run systemctl daemon-reload
and systemctl restart bluetooth
to apply the changes to the Bluetooth service
Source: https://github.com/ukBaz/python-bluezero/issues/335
Upvotes: 0
Reputation: 21
Check the connection min and max intervals, they shall be compliant with the iOS guidelines: https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf (page 180 - 40.6 Connection Parameters).
You can tune them like this:
echo "30" > /sys/kernel/debug/bluetooth/hci0/conn_min_interval
echo "45" > /sys/kernel/debug/bluetooth/hci0/conn_min_interval
The default values worked for me: [24,40]
Upvotes: 0
Reputation: 166
I believe disabling this bluez config option in /etc/bluetooth/main.conf
would prevent the pi from trying to read characteristics from the iOS device, if that is the issue:
# Do reverse service discovery for previously unknown devices that connect to
# us. For BR/EDR this option is really only needed for qualification since the
# BITE tester doesn't like us doing reverse SDP for some test cases, for LE
# this disables the GATT client functionally so it can be used in system which
# can only operate as peripheral.
# Defaults to 'true'.
#ReverseServiceDiscovery = true
Upvotes: 1