Hi everybody!
I am working on a Bluetooth project based on Linux and an Toradex Colibri iMX6 board. The goal is to establish a BLE connection with a second (custom) device via the GATT Profile. Now the whole system is working on development machines, running current Linux versions but failes on the Colibri.
At first we thought it was an issue with our software but turns out it seems to be a more profound issue in the Linux system itself:
The following code should work but doesnt:
bluetoothctl
scan on
pair AA:BB:CC:DD:EE:FF #dummy MAC-address
The bluetoothctl
command responds with an instant AuthenticationFailed
error despite trying every agent mode available. On different development machines it works, even with the default agent on
.
Bluetooth is enabled via
systemctl start bluetooth.service
connmanctl enable bluetooth
as stated in the Toradx Bluetooth documentation and bluetoothctl
does show the received beacons with all its data but, as stated before, failes to authenticate. We are running a custom build Linux kernel, build with the Yocto toolchain provided so most probably we screwed something up in the process.
My question now is: Where do I find logs or debugging output that helps me find the cause? Neighter dmesg
nor journalctl
give anything usefull. I suspect the ConnMan
to manage the connection and interfere with it but I couldn’t find anything supporting my theory.
Greetings and thanks in advance
Patrick
Hi @stubb0rn,
I’m happy to see that you managed to already find an answer about how to get more logs or some sort of output to visualize what is happening with you Bluetooth usage.
AuthenticationFailed indicates that the pairing was initiated, but you have not confirmed the pin or the pin is incorrect.
Another point that I’ve observed about your steps: You are not triggerting an “agent on” within your bluetoothctl. That is a recommendation before pairing.
I suggest you to try this following sequence of commands at bluetoothctl:
bluetoothctl
power on
agent on
default-agent
scan on
pair AA:BB:CC:DD:EE:FF # The device MAC Address.
Please let me know if that worked.
Best regards,
André Curvello
Thank you for your comment. I found the root cause already with the btmon
output: The Colibri host uses an old kernel version (with similarily old BlueZ stack) and the target device had security features enforced (from higher Bluetooth standard versions) that the old kernel does not implement. Therefore the authentication failed.
As I said, the btmon
-output brought me onto the thought and a verification via a 2nd PC with
bluetoothctl
pairable on
discoverable on
confirmed that it was no host-side problem (e.g. another service managing the Bluetooth connections or such).
As for the agent
thing, you mentioned: The bluetoothctl
automatically registers an agent (at least from our version onwards) so agent on
is not needed. Using default-agent
(from my understanding) is only needed if you want to authenticate a connection, established from another point (e.g. some app running in parallel) or if some service already has registered its agent as default.
Best regards,
Patrick
Hi @stubb0rn,
Could you confirm which version of BSP from Toradex were you using?
Best regards, André Curvello