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?
If you go into the Bluetooth menu on your smartphone, your passcode can be found. You can usually find the Bluetooth menu under the “Settings” section of your phone's settings. The Settings menu needs to have an option to “Get code,” which will let you find the code for your phone by clicking on this option.
Bluetoothctl is a client tool to interact with bluetoothd from the command line. It can be used also to create Agent objects with a specific capability interactively or using command line options.
Open the Activities overview and start typing Bluetooth. Click on Bluetooth to open the panel. Make sure Bluetooth is enabled: the switch at the top should be set to on. With the panel open and the switch on, your computer will begin searching for devices.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With