All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bluetooth: disconnect HFP AG clients
@ 2011-02-16 17:17 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
  2011-02-16 17:37 ` Frederic Danis
  0 siblings, 1 reply; 2+ messages in thread
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis @ 2011-02-16 17:17 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 1775 bytes --]

Clients should be disconnected when VoiceCall atom is unregistered
---
 plugins/hfp_ag.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/plugins/hfp_ag.c b/plugins/hfp_ag.c
index cbf3ccd..5fba13d 100644
--- a/plugins/hfp_ag.c
+++ b/plugins/hfp_ag.c
@@ -40,7 +40,7 @@
 static struct server *server;
 static guint modemwatch_id;
 static GList *modems;
-static guint channel_watch;
+static GSList *client_io;
 
 static const gchar *hfp_ag_record =
 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
@@ -89,6 +89,8 @@ static const gchar *hfp_ag_record =
 static gboolean hfp_ag_disconnect_cb(GIOChannel *io, GIOCondition cond,
 							gpointer user_data)
 {
+	client_io = g_slist_remove(client_io, io);
+
 	return FALSE;
 }
 
@@ -118,8 +120,9 @@ static void hfp_ag_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
 	fd = g_io_channel_unix_get_fd(io);
 	ofono_emulator_register(em, fd);
 
-	channel_watch = g_io_add_watch(io, G_IO_NVAL | G_IO_HUP | G_IO_ERR,
+	g_io_add_watch(io, G_IO_NVAL | G_IO_HUP | G_IO_ERR,
 					hfp_ag_disconnect_cb, NULL);
+	client_io = g_slist_append(client_io, io);
 
 	return;
 
@@ -143,9 +146,18 @@ static void voicecall_watch(struct ofono_atom *atom,
 							NULL);
 	} else {
 		modems = g_list_remove(modems, modem);
-		if (modems == NULL &&  server != NULL) {
-			bluetooth_unregister_server(server);
-			server = NULL;
+		if (modems == NULL) {
+			if (server != NULL) {
+				bluetooth_unregister_server(server);
+				server = NULL;
+			}
+
+			while (client_io) {
+				g_io_channel_shutdown(client_io->data, TRUE,
+							NULL);
+				client_io = g_slist_remove(client_io,
+							client_io->data);
+			}
 		}
 	}
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bluetooth: disconnect HFP AG clients
  2011-02-16 17:17 [PATCH] bluetooth: disconnect HFP AG clients =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
@ 2011-02-16 17:37 ` Frederic Danis
  0 siblings, 0 replies; 2+ messages in thread
From: Frederic Danis @ 2011-02-16 17:37 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

Le 16/02/2011 18:17, Frédéric Danis a écrit :
> Clients should be disconnected when VoiceCall atom is unregistered
> ---
>   plugins/hfp_ag.c |   22 +++++++++++++++++-----
>   1 files changed, 17 insertions(+), 5 deletions(-)
>

Forget this patch, this is not the right thing to do

-- 
Frederic Danis                            Open Source Technology Centre
frederic.danis(a)intel.com                              Intel Corporation


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-16 17:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16 17:17 [PATCH] bluetooth: disconnect HFP AG clients =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-02-16 17:37 ` Frederic Danis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.