Bluetoothctl pairing timeout on Raspberry Pi 3

I have a Raspberry Pi 3B (with built in bluetooth). When using bluetoothctl, I can scan for devices and easily find the device I'm looking for. However, when trying to pair to it, I constantly get a "Failed to pair: org.bluez.ErrorEautenticationFailed". Someone told me it might be because the device I'm trying to connect to has an advertising interval of 10.2 seconds, while Bluez gives a timeout after 2 seconds. Is it correct, that Bluez, per default, times out after 2 seconds, and if yes, how would I get to change this?

Regards

Upvotes: 2

Views: 7606

Answers (2)

I found a solution which works. Apparently, the problem is in the kernel. Here, the auto-connection timeout is set to 2 seconds, lower than what is necessary for some devices. -The solution is to add a small patch to the kernel, build it, and use it. This can be done by following the instructions here: https://www.raspberrypi.org/documentation/linux/kernel/building.md After cloning the kernel from git, modify the file include/net/bluetooth/hci.h the line which needs to be changed looks like this

define HCI_LE_AUTOCONN_TIMEOUT msecs_to_jiffies(2000) /* 2 seconds */

change the value "2000" to "20000" (making the timeout 20 seconds, rather than 2 seconds). Build the kernel as per the instructions above, and things seems to work fine. If anybody has a better solution, which does not require building a new kernel, I would like to hear it, since this process is a bit elaborate.

Upvotes: 2

Alexx Roche
Alexx Roche

Reputation: 3249

You can view the bluetooth IdleTimeout with

grep meout /etc/bluetooth/input.conf

and disable timeout with

sudo sed -i 's/^#IdleTimeout=.*/IdleTimeout=0/' /etc/bluetooth/input.conf

and to undo

sudo sed -i 's/^IdleTimeout=.*/#IdleTimeout=30/' /etc/bluetooth/input.conf

I don't know of an independent timeout for bluez

Upvotes: 0

Related Questions