1

I want to automatically accept Bluetooth pairings with any device that wants to connect, I tried all answers (without python ones) from this question: Automatically accept bluetooth pairings But they don't work for me, if I try to connect to Raspberry Pi, it connects for 10 seconds and then disconnects and prints error aborted by local. I have Raspberry Pi Zero 2 W. I am running latest Raspberry Pi OS.

On my computer when I run bluetoothctl - B8:27:EB:9C:DB:9E is Raspberry Pi

[bluetooth]# connect B8:27:EB:9C:DB:9E
Attempting to connect to B8:27:EB:9C:DB:9E
[CHG] Device B8:27:EB:9C:DB:9E Connected: yes
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 0000110a-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 00001112-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 00001800-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 00001801-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E UUIDs: 0000180a-0000-1000-8000-00805f9b34fb
[CHG] Device B8:27:EB:9C:DB:9E ServicesResolved: yes
Failed to connect: org.bluez.Error.Failed br-connection-unknown
[CHG] Device B8:27:EB:9C:DB:9E ServicesResolved: no
[CHG] Device B8:27:EB:9C:DB:9E Connected: no
[CHG] Device B8:27:EB:9C:DB:9E Connected: yes
[CHG] Device B8:27:EB:9C:DB:9E Connected: no
[DEL] Device B8:27:EB:9C:DB:9E raspberrypi
[NEW] Device B8:27:EB:9C:DB:9E raspberrypi
[DEL] Device B8:27:EB:9C:DB:9E raspberrypi

Raspberry pi log:

[NEW] Device 04:42:1A:5A:42:1B mnxd 
[CHG] Device 04:42:1A:5A:42:1B Connected: no

> HCI Event: Simple Pairing Complete (0x36) plen 7 #1 [hci0] 29.091890 Status: Authentication Failure (0x05) Address: 04:42:1A:5A:42:1B (OUI 04-42-1A) @ MGMT Event: Authentication Failed (0x0011) plen 8 {0x0001} [hci0] 29.091998 BR/EDR Address: 04:42:1A:5A:42:1B (OUI 04-42-1A) Status: Authentication Failed (0x05) > HCI Event: Disconnect Complete (0x05) plen 4 #2 [hci0] 29.092843 Status: Success (0x00) Handle: 12 Reason: Remote User Terminated Connection (0x13)

MN_XD
  • 11
  • 3
  • What is it that is trying to connect to the RPi? Often that error message is because the connecting device is requesting a service on the RPi that doesn't exist so it disconnects it. Do you have bluetoothctl running on the RPi? What is reported in that? Also have sudo btmon running. The output is very verbose but it might give more information to debug this. – ukBaz Nov 01 '22 at 15:17
  • it connects for 10 seconds and then disconnects and prints error aborted by local ... what connects to what? ... what prints the error? – jsotola Nov 01 '22 at 15:19
  • @jsotola I connect my computer running Arch Linux to Raspberry Pi. Error prints blueman-manager on my computer – MN_XD Nov 01 '22 at 15:35
  • @ukBaz Yes I have bluetoothctl running on my Raspberry Pi, btmon doesn't print anything when I try to connect to Raspberry Pi. This is error that after some time bleman-manager prints: Connection Failed: le-connection-abort-by-local. I think this error is because I cannot click allow to pair on my raspberry pi. – MN_XD Nov 01 '22 at 15:40
  • Well done on updating your question with the bluetootchctl log. That is the bluetoothctl log from the Arch Linux computer. What is the bluetoothctl log from the RPi? Try setting up a GATT Server on the RPi and then see if the Arch Linux machine can connect and stay connected. – ukBaz Nov 01 '22 at 15:54
  • Instead of a comment, please edit your question with the log. Not only will it be formatted to be more readable, but it will be indexed better with search engines. – NomadMaker Nov 01 '22 at 16:02
  • I followed https://scribles.net/creating-ble-gatt-server-uart-service-on-raspberry-pi/ tutorial on how to set up a GATT server, and it finally started working. Thank you – MN_XD Nov 01 '22 at 16:44

0 Answers0