Automatic profile switching of bluetooth headset

Hey all,

I managed to set up my bluetooth headset using this guide. I have PulseAudio running in per-user mode. The headset connects fine, and defaults to A2DP, which is exactly what I want. I can then manually switch it to use HSP/HFP when I want to make a call. I’d like to be able to configure this to switch automatically, but I have tried and failed, so I’m hoping one of you can help.

The relevant parts of my configuration.nix:

  hardware.bluetooth = {
    enable = true;
    extraConfig = ''
      [General]
      Enable=Source,Sink,Media,Socket
    '';
  };
  services.blueman.enable = true;

  sound.enable = true;
  hardware.pulseaudio = {
    enable = true;
    extraModules = [ pkgs.pulseaudio-modules-bt ];
    package = pkgs.pulseaudioFull;
    support32Bit = true; # Steam
    extraConfig = ''
      load-module module-bluetooth-policy auto_switch=2
    '';
  };

  system.stateVersion = "19.09";

(that extraConfig doesn’t seem to have made any difference)

Proof that everything is running:

$ pactl list | grep -i 'Name.*module.*blue'
        Name: module-bluetooth-policy
        Name: module-bluetooth-discover
        Name: module-bluez5-discover
        Name: module-bluez5-device

I’m running KDE Plasma 5.16.5. The bluetooth adapter I’m using is an Archer TX3000E by TP-Link (I’m honestly not entirely convinced I have the right drivers for that because I’ve still been unable to get wifi working with it, though I have added "iwlwifi" to the list of kernelModules). lspci shows that device as 07:00.0 Network controller: Intel Corporation Device 2723 (rev 1a)

Any help here would be appreciated. I can provide more info if needed, thanks.

1 Like

I’m also looking for that. I’m using Pipewire.