Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bluetoothctl set passkey

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?

like image 412
Subert Avatar asked Jan 10 '16 19:01

Subert


People also ask

How do I create a Bluetooth passkey?

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.

What is Bluetoothct agent?

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.

How do I set up Bluetooth on Ubuntu?

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.


1 Answers

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
like image 148
Subert Avatar answered Sep 18 '22 11:09

Subert