Hilscher Forum
BLE pairing problems with bluez 5.50 - Printable Version

+- Hilscher Forum (https://forum.hilscher.com)
+-- Forum: netPI - Ruggedized Raspberry Pi with Industrial Ethernet (https://forum.hilscher.com/Forum-netPI-Ruggedized-Raspberry-Pi-with-Industrial-Ethernet)
+--- Forum: Software (https://forum.hilscher.com/Forum-Software)
+--- Thread: BLE pairing problems with bluez 5.50 (/Thread-BLE-pairing-problems-with-bluez-5-50)



BLE pairing problems with bluez 5.50 - abmn - August-8th-2019

Dear community,

I encounter problems pairing BLE devices with the NetPi using the current Bluetooth Docker image (https://hub.docker.com/r/hilschernetpi/netpi-bluetooth). As BLE device I'm using a Bosch XDK (Bluetooth 4.2/BLE) with BLE tutorial example. No security ("Just Works") is used for pairing. Other BT 4.2 or 5.0 device I tried had the same issues. 

Here's what I did:

"hcitool device" shows that the BT RF device is available ("hci0   B8:27:EB:A4:D7:88")

"dmesg" shows no errors or warnings, Bluetooth configuration looks fine
[attachment=104]

In "bluetoothctl"
- default agent is on, BT device is on
- "list" correctly shows the BT RF device ("Controller B8:27:EB:A4:D7:88 BlueZ 5.50 [default]")
- "scan on" correctly lists all available BT devices around, also the Bosch XDK ("Device FC:D6:BD:10:27:10")
- I trust the device: "trust FC:D6:BD:10:27:10"
- "pair FC:D6:BD:10:27:10" at first seems to work: "[CHG] Device FC:D6:BD:10:27:10 Connected: yes", the device's services and characteristics are displayed. 
- But after seconds, the device is disconnected: "Failed to pair: org.bluez.Error.AuthenticationCanceled"
[attachment=105]

"dmesg" now shows error "Bluetooth: SMP security requested but not available"
[attachment=106]

The same device pairs, connects and runs nicely with iOS or Android phones using free BLE tools as "LightBlue". 

Happy to read your ideas! 

-Alexander


RE: BLE pairing problems with bluez 5.50, "org.bluez.Error.AuthenticationCanceled" - Armin@netPI - August-8th-2019

Hello Alex,

I did a quick paring test with our bluetooth container and my iPhone X. I have not had any better device than this.

I started bluetoothctrl utility as you did but I called "pairable on" command first of all to enable pairing mode. Maybe this was missing in your setup.


Code:
[bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# pair F4:06:16:8D:DC:1D
Attempting to pair with F4:06:16:8D:DC:1D
[CHG] Device F4:06:16:8D:DC:1D Connected: yes
Request confirmation
[agent] Confirm passkey 128855 (yes/no): yes
[CHG] Device F4:06:16:8D:DC:1D Paired: yes
Pairing successful
[CHG] Device F4:06:16:8D:DC:1D Connected: no
[CHG] Device F4:06:16:8D:DC:1D Connected: yes
[CHG] Device F4:06:16:8D:DC:1D Connected: no
[CHG] Device F4:06:16:8D:DC:1D Connected: yes
[CHG] Device F4:06:16:8D:DC:1D Connected: no
[bluetooth]#

So when I called the pairing command afterwards my iPhone was asking me for the passcode 12855 (and the pairing command too as you can see in the code section) to confirm and after I did that the pairing succeeded. On the iPhone bluetooth settings dialog I saw now a device "BlueZ 5.50" beeing connected ... after a while it was disconnecting.

Since I have no real application running on my netPI talking to the iPhone over bluetooth right now the connection will to state "Connected: no" after some seconds. When I click on my iPhone to connect to device paired "BlueZ 5.50" again the state changes to "Connected: yes" for a short time and so on.

For me everything works fine right now.