Hacker News new | ask | show | jobs
by jchw 1281 days ago
I'm actually confused; The past couple years, PulseAudio has been pretty good at switching between the two for me. Getting stuck in HSP isn't unique to Linux of course; it can happen if anything holds the mic open, there's reports of issues with both macOS and Windows too, for the same reason. Especially common with programs like Discord.

PulseAudio absolutely supports it with the Bluetooth module's auto_switch feature. I guess I'm not sure if Pipewire supports it, but it's likely handled by whatever is doing session management. I can only assume it's possible to configure Wireplumber to handle it if it doesn't have native support for it yet.

1 comments

Hm, not really sure about `auto_switch`, didn't dig deep enough to find it I guess. PulseAudio only offered HSF/HSP which sounded simply terrible. PipeWire's HSP sounds pretty good (mSBC codec), although it's still obviously worse than A2DP. I'll have to look into auto switching and how to enable on either system.
Are you saying that in pavucontrol, you see no A2DP modes at all? That's very strange, since all Bluetooth certified stuff should at least support A2DP SBC mode.

Out of the box, Pipewire should also be able to support LDAC and maybe AptX. PulseAudio can use Gstreamer to support additional codecs, so on PulseAudio with GStreamer 1.20+ you can get better A2DP coverage, assuming you have the right codec packages installed on your distro.

In general, Linux Bluetooth support has been a lot better as of late, to the point where I didn't need to mess with much, so most of what I know about it is actually older. (I used to use a third-party PulseAudio module to get better A2DP support for example, but when I looked it up, I found that it was deprecated in favor of just using newer GStreamer.)

My personal Bluetooth experience also improved drastically when I finally got around properly importing the pairing keys from Windows into Linux. Now everything works flawlessly.

If anyone is dual-booting Linux and Windows, here's a gotcha to keep in mind: Bluetooth pairing works using keys associated the MAC address of a Bluetooth interface. If you pair a device on Windows (key A) and then try to pair/connect to the same device after booting into Linux (key B), it simply won't work without anything telling you the real reason: To the device it looks like someone is impersonating the host interface, since it was previously set up using key A, but suddenly someone (Linux) pretends to be the same host (MAC address still the same) but with key B. The solution is simply looking up the key in the Windows registry and then using the same key in Linux.

Unfortunately, the process is a little complicated, but the Arch wiki page [1] does a really good job of explaining this nowadays. I've previously tried to set this up a few years back, but it didn't really work. Perhaps the wiki page was expanded in the meantime, or I simply did something wrong back then.

Just posting this here hoping I might be able to help some people wondering why the hell some of their devices just don't want to connect on Linux.

By the way, AFAIK some devices just don't care about the keys, that's why you might only have issues with a subset of devices.

[1] https://wiki.archlinux.org/title/Bluetooth#Dual_boot_pairing

jelicicm mentioned ubuntu in the original comment. I seem to remember that as of Ubuntu 20.04, LDAC wasn't supported. I needed to jump through some hoops to get it to work. It was still using full-on pulseaudio, not pipewire, at the time. I wouldn't be surprised for it to still not support non-free codecs out of the box.

I've indeed had no issues on my Arch install. Works perfectly with LDAC on my Sony headphones and aptx-hd on my Shure.

The mic of the Sony is a bad joke so I never use it, but I've tried it and switching modes worked fine on Linux.

I hear you on that one. I'm patiently awaiting end-to-end support for LE audio with bidirectional audio streams, and maybe, if we're really lucky, Sony will release a pair of headphones that has a better microphone to go with it.
Sorry, not saying that. I do have an option of either A2DP or HSP. I was not familiar with auto switch. But you kind people have filled me in in this thread. A2DP sounds amazing for listening to music, no problems there. The problem is the hassle of switching between profiles, since I tend to use my headphones in work environment (calls, meetings) - this is the reason I still keep a pair of cabled headphones around.
Interesting. Not sure what the deal is. Someone is suggesting that at least for PulseAudio, it could just be the older version of PulseAudio that shipped with Ubuntu. However, you should be able to get it working on Pipewire just as well. Pipewire stuff is still pretty immature, so your distro may have an older and less stable Wireplumber at the moment. In that case, it might be worth just trying to set the Pipewire Media Session option for this instead. Wireplumber is really powerful, though, so it's a nice tool to have available.
+1 For Pipewire + Wireplumber! With it, automatic codec switching has worked quite well for me!