[PATCH] Init telephony before adding HFP SDP records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please review.

Regards,
Daniel
From bbc64db8c307b060b55b53c7006f57d63a86effe Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@xxxxxxxxx>
Date: Thu, 26 May 2011 15:35:19 +0300
Subject: [PATCH] Init telephony before adding HFP SDP records

By patch b9d85c00108977b24ae91ea8ecedb9ceffe6f648 the initialization
of the telephony subsystem is delayed in the bluetoothd startup
procedure. As a result the SupportedFeatures bitmap has not been set
when creating the HFP SDP record. This patch calls the first
initialization from the previous place so that the record
gets the correct value.

Although the corresponding bit in +BRSF is correctly set, the
missing bit for the "Three-way calling" feature in the SDP record
causes some headsets not to send AT+CHLD=? in certain situations.
This results in failed connections since BlueZ does not enter the
"connected" state on the headset interface before that command is
received, if the feature is supported by both sides.
---
 audio/manager.c |   39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/audio/manager.c b/audio/manager.c
index 3518137..ce20676 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -854,25 +854,12 @@ static struct audio_adapter *audio_adapter_get(struct btd_adapter *adapter)
 	return adp;
 }
 
-static void state_changed(struct btd_adapter *adapter, gboolean powered)
+static void setup_telephony(gboolean powered)
 {
 	struct audio_adapter *adp;
 	static gboolean telephony = FALSE;
 	GSList *l;
 
-	DBG("%s powered %s", adapter_get_path(adapter),
-						powered ? "on" : "off");
-
-	/* ignore powered change, adapter is powering down */
-	if (powered && adapter_powering_down(adapter))
-		return;
-
-	adp = find_adapter(adapters, adapter);
-	if (!adp)
-		return;
-
-	adp->powered = powered;
-
 	if (powered) {
 		/* telephony driver already initialized*/
 		if (telephony == TRUE)
@@ -897,6 +884,26 @@ static void state_changed(struct btd_adapter *adapter, gboolean powered)
 	telephony = FALSE;
 }
 
+static void state_changed(struct btd_adapter *adapter, gboolean powered)
+{
+	struct audio_adapter *adp;
+
+	error("%s powered %s", adapter_get_path(adapter),
+						powered ? "on" : "off");
+
+	/* ignore powered change, adapter is powering down */
+	if (powered && adapter_powering_down(adapter))
+		return;
+
+	adp = find_adapter(adapters, adapter);
+	if (!adp)
+		return;
+
+	adp->powered = powered;
+
+	setup_telephony(powered);
+}
+
 static int headset_server_probe(struct btd_adapter *adapter)
 {
 	struct audio_adapter *adp;
@@ -1223,8 +1230,10 @@ proceed:
 	if (enabled.media)
 		btd_register_adapter_driver(&media_server_driver);
 
-	if (enabled.headset)
+	if (enabled.headset) {
+		setup_telephony(TRUE);
 		btd_register_adapter_driver(&headset_server_driver);
+	}
 
 	if (enabled.gateway)
 		btd_register_adapter_driver(&gateway_server_driver);
-- 
1.6.0.4


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux