Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Bluetooth headphones and pipewire [solved]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6764

PostPosted: Sat Jun 29, 2024 9:03 pm    Post subject: Bluetooth headphones and pipewire [solved] Reply with quote

I know that there is a similar thread, but my problem is a bit different:

As in the mentioned thread, I also have sometimes the problem that I cannot connect, but for some unknown reason it succeeds after a few retries, so I guess that this is unrelated.

However, pipewire seems to be completely unaware of the bluetooth device: The output of e.g. mplayer -ao pulse goes straight to my connected loudspeaker, and wpctl status does not show anything related to bluetooth. Also restarting wireplumber does not display anything related to bluetooth.

I have also bluez-alsa installed, and if I set the corresponding asound.conf, the output goes to the bluetooth headphones, so they are indeed working and properly paired/connected and can receive sound.

Versions and active USE-flags:

wireplumber: 0.5.3(systemd -elogind -system-service)
pipewire 1.0.7(X bluetooth dbus sound-server ssl systemd)

Note that I have USE=systemd enabled and also systemd (hence udev) installed, but I boot with openrc.
This means that logind is not really running, but so far this was never a problem, because I am using wlroots w/ seatd-0.8.0(server -elogind -systemd).


Last edited by mv on Sun Jun 30, 2024 8:04 am; edited 2 times in total
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6122
Location: Dallas area

PostPosted: Sat Jun 29, 2024 9:26 pm    Post subject: Reply with quote

Are you just using whatever default config files for pipewire/wireplumber there are.
Or do you have config files in .config/pipewire and/or .config/wireplumber?
_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
ormorph
n00b
n00b


Joined: 18 Jun 2024
Posts: 27

PostPosted: Sun Jun 30, 2024 4:09 am    Post subject: Reply with quote

Code:
$ bluetoothctl
[bluetooth]# scan on
#out
...
[bluetooth]# [CHG] Device xx:xx:xx:xx:xx:xx
...
# run
[bluetooth]# connect xx:xx:xx:xx:xx:xx

Is the connection working? If not, what is the output after executing the command: connect xx:xx:xx:xx:xx:xx
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6764

PostPosted: Sun Jun 30, 2024 6:01 am    Post subject: Reply with quote

Anon-E-moose wrote:
Are you just using whatever default config files for pipewire/wireplumber there are.
Or do you have config files in .config/pipewire and/or .config/wireplumber?

I add the files
/etc/pulseaudio/client.pulse wrote:
autospawn = no

and added or modified
/etc/pipewire/pipewire-pulse.conf.d/pipewire-pulse.conf wrote:
pulse.properties = {
server.address = [
"unix:native"
"tcp:127.0.0.1:4713"
]
vm.overrides = {
pulse.min.quantum = 1024/48000
}
}

I also added for bluealsa the /etc/dbus-1/system.d/bluealsa.conf and etc/alsa/conf.d/20-bluealsa.conf from https://wiki.gentoo.org/wiki/Bluetooth_headset (with MAC addresses adapted; this is perhaps a bit too long to repost here), and
/etc/asound.conf wrote:
defaults.bluealsa {
interface "hci0" # host Bluetooth adapter
device "41:42:FF:B3:D8:93" # Bluetooth headset MAC address
profile "a2dp"
}
(which takes only effect if I use the alsa device bluealsa; changing the alsa output to bluealsa in asound.conf unsurprisingly has only effect if e.g. mplayer outputs to alsa).

There were by default the symlink /etc/alsa/c onf.d/dca -> ../../../usr/share/alsa/pcm/dca.conf and
/etc/wireplumber/wireplumber.conf.d/entoo-sound-server-enable-audio-bluetooth.conf wrote:
wireplumber.profiles = {
main = {
hardware.audio = required
hardware.bluetooth = required
}
}
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6764

PostPosted: Sun Jun 30, 2024 6:11 am    Post subject: Reply with quote

ormorph wrote:
Code:
$ bluetoothctl
[bluetooth]# scan on
#out
...
[bluetooth]# [CHG] Device xx:xx:xx:xx:xx:xx
...
# run
[bluetooth]# connect xx:xx:xx:xx:xx:xx

Is the connection working? If not, what is the output after executing the command: connect xx:xx:xx:xx:xx:xx

As mentioned, sometimes it is as in the other thread:
Quote:
Attempting to connect to xx:xx:xx:xx:xx:xx
[bluetooth]# Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable

However, eventually (either after sufficiently many retries or sufficiently many attempts), I get
Quote:
hci0 xx:xx:xx:xx:xx:xx type BR/EDR connected eir_len 5
[CHG] Device xx:xx:xx:xx:xx:xx Connected: yes
[B8]# [NEW] Endpoint /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/sep1
[B8]# [NEW] Endpoint /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/sep2
[B8]# [NEW] Transport /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/sep1/fd2
[B8]# Connection successful
[B8]# [CHG] Transport /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/sep1/fd2 Volume: 0x0058 (88)
[B8]# [CHG] Device xx:xx:xx:xx:xx:xx ServicesResolved: yes

B8 is the bluetooth name of my headphone (when I pair it with my smartphone).

Edit: Unrelated, but maybe somebody knows: I have to enable USE="extra-tools deprecated" for bluez to have bluetoothctl and hciconfig, and the descriptions of these USE-flags contain that the tools are intentionally not installed and should not be used. Do I have to be afraid that they go away? I found no alternatives. For instance, blueman showed only an error that a headphone icon is missing instead of presumably showing something that I could click for pairing, and the gnome tool is only a library which I cannot use as I do not use gnome. Similarly, the dependencies of the kde tool are horrible if you are not a kde user, anyway.
Back to top
View user's profile Send private message
ormorph
n00b
n00b


Joined: 18 Jun 2024
Posts: 27

PostPosted: Sun Jun 30, 2024 6:36 am    Post subject: Reply with quote

mv wrote:

Quote:
Attempting to connect to xx:xx:xx:xx:xx:xx
[bluetooth]# Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable

However, eventually (either after sufficiently many retries or sufficiently many attempts), I get


It may be necessary to first remove the device and then reconnect it. You can also see the latest message here, тhis also solves the problem.
You can also add a line to the /etc/bluetooth/main.conf file:
Code:
ControllerMode = bredr

Often, if I connected previously on a different OS, then I have to delete the device after that and connect again.
Code:
[bluetooth]# devices
Device xx:xx:xx:xx:xx:xx name
[bluetooth]# remove xx:xx:xx:xx:xx:xx

Perhaps one of these options will help you.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6764

PostPosted: Sun Jun 30, 2024 7:55 am    Post subject: Reply with quote

Quote:
ControllerMode = bredr

This did not really improve the situation, perhaps it made it even worse. (There were some messages that connection with bredr failed.) Perhaps I had no success at all with this option. (I tried so much that it is hard to say.)
ormorph wrote:
You can also see the latest message here, тhis also solves the problem.

That did the trick! Adding the line monitor.bluez.seat-monitoring = disabled to the main section of /etc/wireplumber/wireplumber.conf.d/gentoo-sound-server-enable-audio-bluetooth.conf and restarting pipewire+wireplumber helped.

I just did not realize this first, because I almost did not hear anything: Under pipewire, the volume is much lower, and I do not know a way to control the volume (e.g. modifying with pavucontrol has no effect). With bluealsa, there exists the option --initialvolume=[0-100]. Does something similar exist for wireplumber?

I will open a separate thread for the volume.
Back to top
View user's profile Send private message
Anon-E-moose
Watchman
Watchman


Joined: 23 May 2008
Posts: 6122
Location: Dallas area

PostPosted: Sun Jun 30, 2024 9:51 am    Post subject: Reply with quote

I had problems with bluetooth connecting occasionally with the dongle I was using (tp-link ub500) where I might have to disconnect/connect
a few times till it decided to connect. Because of that I did start doing things like making the connect mode only bredr, I don't really have
any true BLE devices so no harm on my end.
But I bought a new minipc with onboard bluetooth, and it works like a charm, never a problem with connection.
So sometimes it's the bluetooth controller that might be the problem.

I had forgotten about the monitor settings, I turn those off.

Code:
    monitor.alsa.reserve-device = disabled
    monitor.bluez.seat-monitoring = disabled

_________________
PRIME x570-pro, 3700x, 6.1 zen kernel
gcc 13, profile 17.0 (custom bare multilib), openrc, wayland
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6764

PostPosted: Sun Jun 30, 2024 12:09 pm    Post subject: Reply with quote

Anon-E-moose wrote:
So sometimes it's the bluetooth controller that might be the problem.

This might very well be. I paid << 2 bucks for this no-name dongle, but once it is connected it seems to work pretty well.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum