summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikel Astiz <mikel.astiz@bmw-carit.de>2012-12-03 11:03:59 +0100
committerTanu Kaskinen <tanuk@iki.fi>2012-12-04 03:11:23 +0200
commitbbb47c67bb4434d752f2225d7f1744721c6e6054 (patch)
tree29208c8e7a58b723e29a307c2d6765315c216e64
parent01435e613417258f35e406f1ab95042b1c48b832 (diff)
bluetooth: Request headset audio during profile switch
When a headset is having a profile switch, we can either leave the SCO state unmodified (as it was before this patch) or we can alternatively request it (as older versions of PA). This patch tries to avoid a potential regression in case a module such as module-suspend-on-idle is not present, due to the provided resume-on-running policy. Without this patch, and without such a policy, the sink and sources would stay suspended until the user manually performed another profile switch (i.e. hsp->off->hsp). There are several other solutions currently being discussed as a longer term solution, some of which require extendind the core. This patch is therefore proposed as a short-term workaround to avoid the regression.
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index f8315e1e..093550e0 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1743,7 +1743,7 @@ static int add_sink(struct userdata *u) {
switch (u->profile) {
case PROFILE_A2DP:
case PROFILE_HSP:
- data.suspend_cause = PA_SUSPEND_IDLE;
+ pa_assert_not_reached(); /* Profile switch should have failed */
break;
case PROFILE_HFGW:
data.suspend_cause = PA_SUSPEND_USER;
@@ -1818,7 +1818,7 @@ static int add_source(struct userdata *u) {
if (!bt_transport_is_acquired(u))
switch (u->profile) {
case PROFILE_HSP:
- data.suspend_cause = PA_SUSPEND_IDLE;
+ pa_assert_not_reached(); /* Profile switch should have failed */
break;
case PROFILE_A2DP_SOURCE:
case PROFILE_HFGW:
@@ -2011,7 +2011,10 @@ static int setup_transport(struct userdata *u) {
u->transport_removed_slot = pa_hook_connect(&t->hooks[PA_BLUETOOTH_TRANSPORT_HOOK_REMOVED], PA_HOOK_NORMAL,
(pa_hook_cb_t) transport_removed_cb, u);
- bt_transport_acquire(u, FALSE);
+ if (u->profile == PROFILE_A2DP_SOURCE || u->profile == PROFILE_HFGW)
+ bt_transport_acquire(u, FALSE); /* In case of error, the sink/sources will be created suspended */
+ else if (bt_transport_acquire(u, TRUE) < 0)
+ return -1; /* We need to fail here until the interactions with module-suspend-on-idle and alike get improved */
bt_transport_config(u);