3

I want to set up the Bluetooth on boot so I can connect to it whenever I want with a device which is not trusted by the Raspberry Pi Bluetooth. I set up the Bluetooth on boot on my Raspberry Pi this way. In /etc/rc.local, I added :

sudo bluetoothctl <<EOF
power on
discoverable on
pairable on
EOF

sudo hciconfig hci0 sspmode 0
sudo bt-agent -c NoInputNoOutput -p /root/bluetooth.cfg &

I use a Bluetooth configuration file to secure the Bluetooth connection, more information here

The problem is, after some time (~3 minutes), the discoverable mode is automatically turned OFF and I cannot connect to

Another problem is, after a device connect/disconnect, the discoverable mode is also turned OFF.

Is this possible to keep the discoverable mode ON every time and even if some Bluetooth devices connect/disconnect to the Raspberry ?

Edit: I'm using the Raspberry Pi Model B V1.2

Antoine Boré
  • 111
  • 1
  • 10

2 Answers2

6

I continued my research and found an answer that works for me. There is a DiscoverableTimeout on /etc/bluetooth/main.conf which is, by default, set to 300s.

I just add DiscoverableTimeout = 0 on this configuration files.

Antoine Boré
  • 111
  • 1
  • 10
0

You need to trust the device you are trying to connect to through Bluetooth of the Raspberry Pi (look up help menu for list of available commands). I could only get partial pairing enabled on my iPhone, until I trusted the iPhone MAC address.

Greenonline
  • 2,969
  • 5
  • 27
  • 38