Bluetooth Issues with Airpods Pro 2 on Debian 12

I’m currently trying to move from Ubuntu 22.04.2 LTS to Debian 12, and everything is so much more stable and reliable here. But there is one problem:
My Airpods Pro (Generation 2) don’t really work. Let me elaborate.

With stock settings, they cannot connect at all, so I added this line to the bluetooth config file (/etc/bluetooth/main.conf) at the right place:

ControllerMode = bredr

I got this information from this AskUbuntu Post: https://askubuntu.com/a/1429341

This fixed the problem of not being able to connect the Airpods, and made them work with A2DP on Ubuntu. But here on Debian, only the Hands-Free audio is working (which sounds horrible).
I tried following some advice from this arch wiki page in a live install, because I didn’t want to break my system, and it didn’t really help:

https://wiki.archlinux.org/title/bluetooth_headset

I tried connecting my other pair of Bluetooth Headphones, Sennheiser 450BT, and they worked flawlessly.
I also tried switching btmgmt ssp on and btmgmt ssp off, the second one broke everything and I had to restart the live session.

I don’t know what is different on Ubuntu 22.04.2 LTS, and why my Airpods Pro 2 work there, but not here.

Suspicion: The Airpods send some sort of non-standard/proprietary signal, and if they get the response that they are not connected to an iThing they start mocking up.

I’d like to add that the experience on Ubuntu wasn’t flawless either, and they would disconnect/the audio would glitch to static noise/corruption every now and then. I would guess around every 3-4 hours of use once, but sometimes 4-5 times in a row. Then you’d have to restart bluetooth and connect them again. It was a bit annoying, but acceptable.

So can anybody help me with this problem? I’d greatly appreciate it!

I’m using a Lenovo ThinkPad Yoga 12.

Asked By: User1986

||

Experienced the same issue.

Was able to resolve it thanks to this reddit forum. The issue is related to the AAC codecs, which aren’t included in PipeWire by default due to licensing issues which prevented the owners from actually compiling the implementation, even though it is still in the official repository.

You can either (1) install this package, which is a re-compilation of PipeWire’s dependency to include the AAC (and aptX) codecs (more info here), however this may involve tampering with existing OS installations.

Alternatively, you can (2) install the libfdk-aac-dev library and download the precompiled binary dependency of the said package, extract it and all its sub-compressions, and place /.../libspa-0.2-bluetooth_0.3.65-4~glasgall1_amd64/usr/lib/x86_64-linux-gnu/spa-0.2/bluez5/libspa-codec-bluez5-aac.so in /usr/lib/x86_64-linux-gnu/spa-0.2/bluez5/. Then, just give the computer a good ole’ reboot.

After either method you should be able to pick the AAC codec:enter image description here

P.S.: Or you can (3) rebuild libspa from scratch yourself with the AAC codec if you’re up for the challenge, though I do not recommend. 🙂

Answered By: markkoszy

With the help of markkoszy’s answer, I wrote a script that builds a package whose sole function is to place the libspa-codec-bluez5-aac.so file in the right place. In addition, this package requires libfdk-aac-dev as a dependency. So all you need to do is install this package to solve the problem properly (without manually copying a file into the system tree).

https://gist.github.com/jpasquier/65e95707089f79d9406fa8e7f9e96eb0

running with script as current user will create the package in the current directory

Answered By: jpas78