Skip to contentSkip to conversation

fix the bug introduced by commit "re-use the sco_server initiated by audio plugin"

PATCH In review Forrest Zhao 2 participants 3 messages Jun 19, 2009 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix the bug introduced by commit "re-use the sco_server initiated by audio plugin"

---
 audio/gateway.c |    3 ---
 audio/main.c    |    4 ++++
 2 files changed, 4 insertions(+), 3 deletions(-)
audio/gateway.c +0 -3
index a170bec..607a4a0 100644
@@ -1079,9 +1079,6 @@ int gateway_connect_sco(struct audio_device *dev, GIOChannel *io)
 {
 	struct gateway *gw = dev->gateway;
 
-	if (gw->sco)
-		return -EISCONN;
-
 	gw->sco = g_io_channel_ref(io);
 
 	return 0;
audio/main.c +4 -0
index 4e5eda2..cf16fd4 100644
@@ -93,6 +93,10 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
 	device = manager_find_device(NULL, &src, &dst, AUDIO_HEADSET_INTERFACE,
 					FALSE);
 	if (!device)
+		device = manager_find_device(NULL, &src, &dst,
+						AUDIO_GATEWAY_INTERFACE, FALSE);
+
+	if (!device)
 		goto drop;
 
 	if (device->headset) {
Signature · 1 line
1.5.4.5
#1 lore raw

Hi Forrest,

audio/gateway.c int gateway_connect_sco(struct audio_device *dev, GIOChannel *io) · line 1082

Quoted 8 lines · Forrest Zhao
audio/gateway.c +0 -3
@@ -1079,9 +1079,6 @@ int gateway_connect_sco(struct audio_device *dev, GIOChannel *io)
 {
 	struct gateway *gw = dev->gateway;
 
-	if (gw->sco)
-		return -EISCONN;
-
 	gw->sco = g_io_channel_ref(io);

This part looks wrong. If gw->sco is non-NULL you'd be causing a memory leak. Why do you think that returning -EISCONN is wrong here?

Johan

#2 lore raw
In reply to Forrest Zhao

Hi Forrest,

audio/main.c static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data) · line 100

Quoted 11 lines · Forrest Zhao
audio/main.c +4 -0
@@ -93,6 +93,10 @@ static void sco_server_cb(GIOChannel *chan, GError *err, gpointer data)
 	device = manager_find_device(NULL, &src, &dst, AUDIO_HEADSET_INTERFACE,
 					FALSE);
 	if (!device)
+		device = manager_find_device(NULL, &src, &dst,
+						AUDIO_GATEWAY_INTERFACE, FALSE);
+
+	if (!device)
 		goto drop;

I went ahead and commited this second part of your patch since it looks correct and is good too have in before the next release (due out today).

Johan