nicokaiser / rpi-audio-receiver

Raspberry Pi Audio Receiver with Bluetooth A2DP, AirPlay 2, and Spotify Connect
MIT License
1.36k stars 150 forks source link

BT Pairing requires accepting #130

Closed bortek closed 11 months ago

bortek commented 2 years ago

I am running server on Pi and raspbian in GUI/Desktop mode(connected via VNC). When I try to pair using my phone via bluetooth what happens is that a prompt asking "do you want to pair" pops up. I am running a headless Pi and want to pairing to be smoothly without any popups. That is anyone should be able to pair.

Is it possible to configure it like that and if yes then how do I do it?

svrooman commented 2 years ago

I get asked to enter a PIN :|

arxeiss commented 2 years ago

I get asked to enter PIN too. So I connected to RPi to SSH and paired devices. However, after changing USB BT dongle to another one, I'm not asking to enter PIN anymore. Weird.

I described it here https://github.com/nicokaiser/rpi-audio-receiver/issues/119#issuecomment-1098765412

nicokaiser commented 2 years ago

I think (!) it is important to use a Bluetooth 4.0 dongle (hciconfig -a can show the HCI Version – here is a mapping).

I tried with a cheap (Bluetooth 2.0) device and it did not work at all. Simple Pairing Mode is only introduced in BT 2.1. You could try to disable SSP and use a PIN like in this fork: https://github.com/nicokaiser/rpi-audio-receiver/compare/main...holypiece:main

/etc/bluetooth/pin.conf

* 1234

/etc/systemd/system/bt-agent@.service

-ExecStartPre=/bin/hciconfig %I sspmode 1
-ExecStart=/usr/bin/bt-agent --capability=NoInputNoOutput
+ExecStartPre=/bin/hciconfig %I sspmode 0
+ExecStart=/usr/bin/bt-agent --capability=NoInputNoOutput --pin /etc/bluetooth/pin.conf

But last time I tried I had no success without SSP and e.g. Apple devices.