summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-11-26 18:32:08 +0100
committerTanu Kaskinen <tanuk@iki.fi>2012-11-29 05:37:45 +0200
commit71bd458bd1f9c92e2d929b8741346112109b17e0 (patch)
tree1cc5211e925741bb469f4ab1d67b5c2712bb2e23
parent40329acc1a28145643e49207e9d65cd05bbda2c8 (diff)
bluetooth: Disable profile auto-switch policy for headsets
Given that headsets have just one single port exposing whether the audio is streaming (playing) or not, it's not possible that module-bluetooth-policy would distinguish A2DP/HSP cases, and thus the automatic selection of the card profile is not deterministic. For this reason, disable the policy entirely for headsets and focus only on HFGW and A2DP source profiles.
-rw-r--r--src/modules/bluetooth/module-bluetooth-policy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c
index 87a5716f..f0bffe9d 100644
--- a/src/modules/bluetooth/module-bluetooth-policy.c
+++ b/src/modules/bluetooth/module-bluetooth-policy.c
@@ -187,6 +187,10 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
if (!s || !pa_streq(s, "bluetooth"))
return PA_HOOK_OK;
+ /* Do not automatically switch profiles for headsets, just in case */
+ if (pa_hashmap_get(port->profiles, "hsp") || pa_hashmap_get(port->profiles, "a2dp"))
+ return PA_HOOK_OK;
+
is_active_profile = card->active_profile == pa_hashmap_get(port->profiles, card->active_profile->name);
if (is_active_profile && port->available == PA_PORT_AVAILABLE_YES)