You are not logged in.

#1 2019-07-19 05:05:37

symon
Member
Registered: 2014-06-25
Posts: 18

Bluetooth automatic profile setting

Hello everyone,
I have a bluetooth headset that I like to use for listening to music. Every now and then it will play the music from my machine excellently but most of the times it sounds really bad.
After a while of digging I figured out it supports two profiles and my machine will chose one on connect.
This is the `pactl list` output:

Karte #0
        Name: bluez_card.20_9B_A5_68_2E_FB
        Treiber: module-bluez5-device.c
        Owner-Modul: 28
        Eigenschaften:
                device.description = "Anker SoundBuds Sport"
                device.string = "20:9B:A5:68:2E:FB"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_20_9B_A5_68_2E_FB"
                bluez.class = "0x240404"
                bluez.alias = "Anker SoundBuds Sport"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        Profile:
                headset_head_unit: Headset Head Unit (HSP/HFP) (Ziele: 1, Quellen: 1, Priorität: 30, verfügbar: ja)
                a2dp_sink: High Fidelity Playback (A2DP-Ziel) (Ziele: 1, Quellen: 0, Priorität: 40, verfügbar: nein)
                off: Aus (Ziele: 0, Quellen: 0, Priorität: 0, verfügbar: ja)
        Aktives Profil: headset_head_unit
        Ports:
                headset-output: Headset (priority: 0, latency offset: 0 usec, available)
                        Teil der/des Profil(s): headset_head_unit, a2dp_sink
                headset-input: Headset (priority: 0, latency offset: 0 usec, available)
                        Teil der/des Profil(s): headset_head_unit

So when it chooses `headset_head_unit` the sound is very poor so I suppose it should select `a2dp_sink` every time. Now I know I can change the profile every time using `pacmd set-card-profile 0 a2dp_sink` but is there a more convenient way to do this?
Especially since the card number changes every time?
Also: How does pulse select the profile in the first place? (I think the `a2dp_sink`-profile actually is not available in the first seconds after connecting.)
I can also change it manually in the KDE settings but that seems to be temporary as well.

Edit: I managed to write a small script, that does change the correct card to the correct mode but I can't seem to find a way to run it on bluetooth-connect. I struggle with udev. Maybe an answer on how to d that would do the job as well.

Thanks in advance
symon

Last edited by symon (2019-07-19 11:14:03)

Offline

#2 2019-07-19 14:41:13

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,770

Re: Bluetooth automatic profile setting

How do you control the Bluetooth device?  I use blueman ro connect to my bluetooth speaker.  I only allow it to open the hi def audio profile and block the "headset" profile


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2019-07-22 07:20:55

symon
Member
Registered: 2014-06-25
Posts: 18

Re: Bluetooth automatic profile setting

I set them up using the KDE menu. So I did not really fiddle around with the background tasks.

Offline

Board footer

Powered by FluxBB