Bluetoothctl set passkey

Subert picture Subert · Jan 10, 2016 · Viewed 35.8k times · Source

I have a Raspberry Pi 2 running Raspbian kernel 4.1.15 and Bluez version 5.23.

I want to be able to connect a device (like an Android phone) to the rapsberry which should accept the connection without user interaction.

With bluetoothct I can make the device discoverable, pair it with another device, but I haven't found the way to set a pin like with bluetooth-agent

bluetooth-agent PIN

Bluetooth-agent is no more available on my system, is there a way I can do that with bluetoothctl?

Answer

Subert picture Subert · Jan 12, 2016

Here is what works thanks to kaylum :

$bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# discoverable on
Changing discoverable on succeeded
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# agent NoInputNoOutput
Agent registered
[bluetooth]# default-agent 
Default agent request successful

Then I pair the raspberry with my phone from the phone.

[NEW] Device XX:XX:XX:XX:XX:XX nameofthedevice
[CHG] Device XX:XX:XX:XX:XX:XX UUIDS:
      --UUIDS--
[CHG] Device XX:XX:XX:XX:XX:XX Paired: yes