[PATCH v0 1/3] audio: fix omitting headset records if AG found

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

During pairing both records can be registered, when an incoming
connection is handled by the gateway server (hf_io_cb). In any case only
the AG record should be left, and thus the headset record must be either
omitted or removed.

Without this patch, both device->headset and device->gateway can be set.
The first point where this causes trouble is inside sco_server_cb, where
the state of the headset is checked (disconnected) and the incoming SCO
request is refused.
---
 audio/manager.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/audio/manager.c b/audio/manager.c
index 68a0a56..ab97314 100644
--- a/audio/manager.c
+++ b/audio/manager.c
@@ -182,7 +182,9 @@ static void handle_uuid(const char *uuidstr, struct audio_device *device)
 	switch (uuid16) {
 	case HEADSET_SVCLASS_ID:
 		DBG("Found Headset record");
-		if (device->headset)
+		if (device->gateway)
+			DBG("Omitting record because Handsfree AG exists");
+		else if (device->headset)
 			headset_update(device, uuid16, uuidstr);
 		else
 			device->headset = headset_init(device, uuid16,
@@ -193,7 +195,9 @@ static void handle_uuid(const char *uuidstr, struct audio_device *device)
 		break;
 	case HANDSFREE_SVCLASS_ID:
 		DBG("Found Handsfree record");
-		if (device->headset)
+		if (device->gateway)
+			DBG("Omitting record because Handsfree AG exists");
+		else if (device->headset)
 			headset_update(device, uuid16, uuidstr);
 		else
 			device->headset = headset_init(device, uuid16,
@@ -201,8 +205,12 @@ static void handle_uuid(const char *uuidstr, struct audio_device *device)
 		break;
 	case HANDSFREE_AGW_SVCLASS_ID:
 		DBG("Found Handsfree AG record");
-		if (enabled.gateway && (device->gateway == NULL))
+		if (enabled.gateway && (device->gateway == NULL)) {
 			device->gateway = gateway_init(device);
+
+			if (device->headset != NULL)
+				headset_unregister(device);
+		}
 		break;
 	case AUDIO_SINK_SVCLASS_ID:
 		DBG("Found Audio Sink");
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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