MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.82k stars 494 forks source link

Can’t connect a bluetooth headset #6985

Open johackim opened 6 months ago

johackim commented 6 months ago

Creating a bug report/issue

[x] I have searched the existing open and closed issues

Required Information

G_DIETPI_VERSION_CORE=9
G_DIETPI_VERSION_SUB=2
G_DIETPI_VERSION_RC=1
G_GITBRANCH='master'
G_GITOWNER='MichaIng'

Steps to reproduce

  1. dietpi-config
  2. Advanced Options
  3. Bluetooth: [On]
  4. bluetoothctl scan on
  5. bluetoothctl pair DEVICE_ID
  6. bluetoothctl trust DEVICE_ID
  7. bluetoothctl connect DEVICE_ID

Expected behaviour

Actual behaviour

Extra details

MichaIng commented 6 months ago

See here: #3456

Try this:

apt install bluez-alsa-utils
aplay -l
speaker-test -D bluealsa

I am not sure whether the bluealsa service does/tries binding to BT audio devices automatically or just allows manual binding, or is not related to this at all. Also probably a reboot is required, or unmuting the volume:

alsamixer -D bluealsa

When this BT audio PCM generally works, you can make it the default:

echo -e 'pcm.!default bluealsa\nctl.!default bluealsa' > /etc/asound.conf
johackim commented 5 months ago

Thank you very much @MichaIng!

It works 😀!

However, I have to connect my Bluetooth headset before running Kodi, or exit Kodi to reconnect my Bluetooth headset if the connection is lost.

I can't autostart Kodi.

MichaIng commented 5 months ago

Okay, so pairing still needs to be done manually. Somehow makes sense. I have not much experience with bluez, but wonder whether there is a native way to have it connecting to a particular device automatically (given that the device accepts it). Else, you could create a script for that and place it into /var/lib/dietpi/postboot.d to be executed automatically on boot.

Hoempi commented 1 month ago

If I may, I'd like to piggyback on this Thread. I'm also trying to connect a bluetooth audio device, in my case an Alexa smart speaker. My end goal is to install plexamp-headless via docker and send the audio output via bluetooth to the Alexa.

But I always get an error when trying to connect using bluetoothctl: "Failed to connect: org.bluez.Error.Failed". But I also did not succeed in installing bluez-alsa-utils as apt does not find any package by that name.

I'm running DietPi v9.6.1 on a RPi 3 Model B (aarch64)

// Edit: Trying to connect to an Anker brand bluetooth speaker yields the same result. Pairing and trusting works, but trying to connect fails.