I ran into some issue using Bluetooth with the verdin-imx8mp on TorizonOS.
The bluetooth service is up and running, bluetoothctl works but when i pair its ok but when i try to connect i got this issue :
Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable
And this message in systemclt :
…/bluez-5.65/src/service.c:btd_service_connect() a2dp-source profile connect failed for Protocol not available.
Plus in the cpp code when i call hci_get_route(nullptr) on a container where /dev volume is bind, I got no adapter.
How can i fix it ?
Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!
Did you like my answer?
It seems like you’re encountering a couple of issues with Bluetooth on the Verdin iMX8MP running TorizonOS. Let’s address them one by one.
Issue 1: A2DP Profile Connection Failure
The error message Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable
and the log a2dp-source profile connect failed for Protocol not available
suggest that the A2DP profile is not available or not properly configured. Here are some steps to troubleshoot this:
-
Ensure A2DP Support: Verify that the A2DP profile is enabled in your BlueZ configuration. You can check the BlueZ configuration file (usually located at
/etc/bluetooth/main.conf
) and ensure that theEnable
directive includesa2dp-source
. -
Install Required Packages: Make sure that all necessary packages for A2DP are installed. You might need
bluez-alsa
or similar packages that provide A2DP support. -
Check Kernel Modules: Ensure that the necessary kernel modules for Bluetooth and A2DP are loaded. You can check this with
lsmod | grep bluetooth
. -
Restart Bluetooth Service: After making any changes, restart the Bluetooth service:
sudo systemctl restart bluetooth
Issue 2: hci_get_route(nullptr)
Not Finding Adapter
The issue with hci_get_route(nullptr)
not finding an adapter in your container could be due to the container not having access to the Bluetooth device. Here are some steps to resolve this:
-
Bind Mount /dev: Ensure that the
/dev
directory is properly bind-mounted into the container. Your Docker run command should include:docker run --rm -it --privileged -v /dev:/dev <your-container>
-
Check Bluetooth Device Access: Inside the container, check if the Bluetooth device is accessible:
ls /dev | grep hci
-
Install BlueZ in Container: Ensure that BlueZ and its utilities are installed inside the container. You can add this to your Dockerfile:
RUN apt-get update && apt-get install -y bluez
-
Run Container with Privileged Flag: Sometimes, running the container with the
--privileged
flag can help in accessing hardware devices:
Issue1:
- I’ve no config file /etc/bluetooth/main.conf. There were /etc/bluetooth/input.conf and /etc/bluetooth/network.conf
- How install package on TorizonOS ?
Issue2:
The -it --privileged helps to solve the issue.
Greetings @demol,
Please disregard the ToradexAI about issue 1. It’s AI generated responses don’t always give accurate/correct responses. The only way to install new packages on the host Torizon OS itself is via a Yocto build, which isn’t ideal.
Regarding your connection issue, it seems like there might be a Bluetooth profile missing that your use-case needs. What kind of device are you trying to connect with Bluetooth here?
Best Regards,
Jeremias
Hello Jeremias,
I’m trying to connect my android phone via bluetooth.
In the toradex there were no profile for a2dp-source.
I’ve tried to install blue-alsa and pulseaudio-module-bluetooth in the container and create /etc/bluetooth/main.conf with
[General]
Enable=Source,Sink,Media,Socket
But i can’t connect to my phone.
I see. I was able to observe a similar error myself with my own phone. I will report this internally as It seems something is wrong/missing software-wise on the host OS. This probably can’t be easily solved by installing something in the container since the Bluetooth stack is operating on the host OS.
That said, I can’t guarantee with any certainty that the team will be able to look into this in the near future. We’re in the middle of development for our next 7.X OS releases, which is taking nearly all of our development attention.
Is Bluetooth vital for your system?
Best Regards,
Jeremias
Yes, unfortunately, Bluetooth is a big part of our project.
But if I change the OS from TorizonOs to the Toradex Embedded Linux Reference Multimedia, does it solve this problem ?
But if I change the OS from TorizonOs to the Toradex Embedded Linux Reference Multimedia, does it solve this problem ?
I actually did try the reference image as well. With my Android phone I got a different error actually, seems like a timeout of some kind. Though you should try, perhaps it will be different for your setup. I at least didn’t get the same error as in Torizon OS.
Best Regards,
Jeremias
With the Toradex Embedded Linux Reference Multimedia the Bluetooth connection with a phone works.
I have also solved the issue with TorizonOs with a docker container with PulseAudio configured with load-module module-bluetooth-policy and load-module module-bluetooth-discover in /etc/pulse/default.pa. We also need to bind the volume /var/run/dbus between the board and the container.
If the container and PulseAudio are running, the profiles are added correctly.
I have also solved the issue with TorizonOs with a docker container with PulseAudio configured with load-module module-bluetooth-policy and load-module module-bluetooth-discover in /etc/pulse/default.pa. We also need to bind the volume /var/run/dbus between the board and the container.
If the container and PulseAudio are running, the profiles are added correctly.
Interesting, I don’t believe anyone has tried this approach before to any success. If you don’t mind could you detail the exact steps you did to solve this. It could be very helpful for others and even our own team.
Best Regards,
Jeremias