tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to connect to bluetooth headphones

malte-v opened this issue · comments

When trying to connect to my bluetooth headphones (2nd gen airpods pro), bluetoothctl prints Failed to connect: org.bluez.Error.Failed br-connection-profile-unavailable and bluetoothd logs a2dp-sink profile connect failed for [mac address]: Protocol not available. I've tried re-pairing the headphones, and while they seem to connect successfully after re-pairing, the connection only lasts about two seconds and ends with the above error message. I'm using the provided sound config via hardware.asahi.setupAsahiSound = true along with the following snippet from the NixOS wiki:

    # bluetooth stuff, see https://nixos.wiki/wiki/PipeWire
    pipewire.wireplumber.configPackages = [
      (pkgs.writeTextDir "share/wireplumber/bluetooth.lua.d/51-bluez-config.lua" ''
        		bluez_monitor.properties = {
        			["bluez5.enable-sbc-xq"] = true,
        			["bluez5.enable-msbc"] = true,
        			["bluez5.enable-hw-volume"] = true,
        			["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
        		}
        	'')
    ];

I've also tried setting the bluetooth ControllerMode to bredr as suggested in some forum threads, which didn't help either. Any ideas what could be the issue? Thanks!

hardware: 13-inch M2 macbook air
nixos-apple-silicon version: release-2024-03-24

I could connect my Bluetooth earbuds (and all my other Bluetooth devices) successfully using this trick from the arch wiki:
Problems with the Logitech BLE mouse (M557, M590, M720, anywhere mouse 2, etc)

Even thought it connect properly, there would be stuttering during audio playback.
Other people in the matrix room of fedora asahi have the same issue which lead me to think this is not NixOs specific.

my bluetooth config is as follow:

hardware.bluetooth = {
      enable = true;
      input.General.ClassicBondedOnly = false; #see https://discourse.nixos.org/t/nix-channel-23-11-bluez-and-bluezfull/37285/17
      powerOnBoot = true; # powers up the default Bluetooth controller on boot   
};
services.blueman.enable = true;
hardware.bluetooth.settings = {
	General = {
		Experimental = true;
	};
};

Check if you're connected to a 2.4 GHz wifi network.

Bluetooth and 2.4 GHz WiFi at the same time will be annoying until Bluetooth coexistence.

See https://asahilinux.org/2022/07/july-2022-release/ which mentions this, as well as https://wireless.wiki.kernel.org/en/users/documentation/bluetooth-coexistence.

As an additional datapoint, explicitly explicitly selecting the 5GHz BSSID I can perfectly fine use my bluetooth headsets for hours without any stuttering.

The issue seems to have magically resolved itself.