Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 684  / 2 Years ago, sun, may 29, 2022, 12:15:49

I have a Jabra Evolve 75 headset that I connect via Bluetooth to my Ubuntu 20.04 machine. Everything works fine in principle except for one little annoyance:


Whenever I turn the headset on, it connects and the Output Device is automatically set accordingly in the Sound Settings. This is the way I want it. However, the Input Device remains like it was set before and I manually have to go in to the settings and also change it to Jabra Evolve 75:


enter image description here


How can I configure the settings so that both Input Device and Output Device automatically switch to Jabra Evolve 75 once I turn the headset on?




UPDATE: The Input Device is also automatically switched when the Configuration setting is changed from High Fidelity Playback (A2DP Sink) to HSP/HFP. So if it is possible to automatically select that as a profile, my problem would also be solved.


More From » sound

 Answers
4

Ok, I finally found how to automatically switch to the HFP audio profile, which will then also automatically set the headset microphone as input device.


There are multiple approaches around, but the only way to do this automatically when connecting the bluetooth headset seems to be to create a udev rule which runs a script when the headset is connected. There is a very nice blog post that describes this in-depth which I used to achieve what I wanted and where most of the code below is originally from.


These are the essential steps:



  1. Find out card name and profile using pactl list.
    The output contains two lines that you will need:


    ...
    Card #20
    Name: bluez_card.70_BF_92_C9_F5_D0
    ...
    Profiles:
    a2dp_sink: High Fidelity Playback (A2DP Sink) (sinks: 1, sources: 0, priority: 40, available: yes)
    handsfree_head_unit: Handsfree Head Unit (HFP) (sinks: 1, sources: 1, priority: 30, available: yes)
    off: Off (sinks: 0, sources: 0, priority: 0, available: yes)
    ...

    In this example, the card name is bluez_card.70_BF_92_C9_F5_D0 and the profile name is handsfree_head_unit.



  2. With that, create a script ~/.config/auto-pactl.sh to switch the headset to the HFP profile:


    sleep 2 # wait for the headset to fully connect                                 
    sudo -u '#1000' XDG_RUNTIME_DIR=/run/user/1000
    pactl set-card-profile bluez_card.70_BF_92_C9_F5_D0 handsfree_head_unit
    logger "Switched Jabra headset to HFP profile"


  3. Find out input name of headset using udevadm monitor and then connecting the BT headset. The output should be something like:


    ...
    UDEV [54588.946048] add /devices/virtual/input/input112 (input)
    ...


  4. Find out subsytem, vendor, and product using udevadm info -ap /devices/virtual/input/input112 (replacing the device with whatever the previous command's output was)



  5. With this information, create a udev rule to execute the above script and store it in /etc/udev/rules.d/52-jabra-headset.rules, inserting the values for your card and your username in the appropriate places:


    ACTION=="add", SUBSYSTEM=="input", ATTR{id/vendor}=="0067", ATTR{id/product}=="24a7", RUN+="/home/<myUsername>/.config/auto-pactl.sh"



That worked like a charm for me!


[#1333] Monday, May 30, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
truwom

Total Points: 101
Total Questions: 99
Total Answers: 100

Location: Ivory Coast
Member since Tue, Sep 15, 2020
4 Years ago
truwom questions
Mon, Jan 16, 23, 03:52, 1 Year ago
Wed, Apr 6, 22, 09:16, 2 Years ago
Sat, Mar 4, 23, 05:16, 1 Year ago
;