I need to connect a headless raspberry pi, with an android device via bluetooth (RFCOMM), the rasberry needs to automatically accept pairing requests.
I already searched for solutions, but they seem to not work, so probably I'm missing something crucial in my raspberry setup that breaks everyhing.
So far the solutions I've tried are different, but the one that seems to get closer to the solution is using these 3 commands in the raspberry:
sudo hciconfig hci0 piscan
sudo hciconfig hci0 sspmode 1
sudo hciconfig hci0 class 0x400100
this makes the device discoverable, but when on the phone I try to pair it automatically it refuses the connection.
I tried going with bluetoothctl based on a previous response: Bluetoothctl set passkey
$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
But then again, It would not connect automatically to the device, it still service authorization on the raspberry.
I am in no way a professional in this field, so my knowledge is very limited, but with this matter it really seems that I cannot find any answer online.