You are not logged in.

#1 2021-05-14 17:04:16

ashic
Member
Registered: 2020-01-22
Posts: 68

[Solved]Automatically switching between A2DP and HSP/HFP with pipewire

I have pipewire and pipewire-pulse installed. Using pulseaudio, I could switch between A2DP and HSP/HFP following the steps in the wiki.

When installing pipewire and pipewire-pulse, /etc/pulse/default.pa is removed. Is there some other place where I can set autoswitch=2 and module-bluetooth-policy? Or is there a different approach? I should add that in Blueman I can see both the A2DP-LDAC and HSP/HFP over mSBC profiles, and manually switching between them works.

Last edited by ashic (2021-05-16 12:59:25)

Offline

#2 2021-05-14 18:43:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,736

Re: [Solved]Automatically switching between A2DP and HSP/HFP with pipewire

Offline

#3 2021-05-15 11:35:26

ashic
Member
Registered: 2020-01-22
Posts: 68

Re: [Solved]Automatically switching between A2DP and HSP/HFP with pipewire

Ah... I see. Thanks. Is there a way to switch profiles on the command line? I think I used to use pacmd for this, but I don't have pacmd since going pipewire. Essentially need something that would allow me to assign a keyboard shortcut for a script that would a) switch the bluetooth profile from ldac to mSBC (something I do via Blueman), and b) enable the mSBC headset output and input as the ones to use (I currently do this with pavucontrol).

Offline

#4 2021-05-15 14:07:48

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,736

Re: [Solved]Automatically switching between A2DP and HSP/HFP with pipewire

pactl as opposed to pacmd should still work e.g.

pactl set-card-profile $BLUETOOTHCARDNAME $profile

not all that familiar with the pw tools yet as I'm still on pulse but might be able with them as well. But if it's something you can adjust in pavucontrol pactl should get you the same way.

Offline

#5 2021-05-16 12:59:00

ashic
Member
Registered: 2020-01-22
Posts: 68

Re: [Solved]Automatically switching between A2DP and HSP/HFP with pipewire

Awesome... that worked. I put together the following bash script, and binsymed that for i3wm to switch between profiles:

#!/bin/bash

ldac=`pactl list | grep Active | grep ldac`
card=`pactl list | grep "Name: bluez_card." | cut -d ' ' -f 2`

if [ -n "$ldac" ]; then
    echo "Switching $card to msbc..."
    pactl set-card-profile $card headset-head-unit-msbc
    echo "...done"
else
    echo "Switching $card to ldac..."
    pactl set-card-profile $card a2dp-sink-ldac
    echo "...done"
fi

Offline

Board footer

Powered by FluxBB