summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2009-06-29 17:46:30 +0300
committerLennart Poettering <lennart@poettering.net>2009-07-01 21:00:42 +0200
commit95d3faaac8038116d8008477dcf1034a25ab30a0 (patch)
treef8f92fa07fd652a91786835495d4b5736f6021e0 /src
parente93c6c36fe3bb6961be7c868627b99cafc015ca2 (diff)
downloadpulseaudio-95d3faaac8038116d8008477dcf1034a25ab30a0.tar.gz
bluetooth: don't connect on unconnected profile
Diffstat (limited to 'src')
-rw-r--r--src/modules/bluetooth/module-bluetooth-device.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index f7dbfd9c6..0560ef32a 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -2086,6 +2086,15 @@ static int add_card(struct userdata *u, const pa_bluetooth_device *device) {
u->card->set_profile = card_set_profile;
d = PA_CARD_PROFILE_DATA(u->card->active_profile);
+
+ if ((device->headset_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_HSP) ||
+ (device->audio_sink_state < PA_BT_AUDIO_STATE_CONNECTED && *d == PROFILE_A2DP)) {
+ pa_log_warn("Default profile not connected, selecting off profile");
+ u->card->active_profile = pa_hashmap_get(u->card->profiles, "off");
+ u->card->save_profile = FALSE;
+ }
+
+ d = PA_CARD_PROFILE_DATA(u->card->active_profile);
u->profile = *d;
return 0;