bluetooth: disconnect HFP AG clients
PATCH 1/1 bluetooth: disconnect HFP AG clients
Clients should be disconnected when VoiceCall atom is unregistered
--- plugins/hfp_ag.c | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-)
plugins/hfp_ag.c +17 -5
@@ -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); + } } } }
Signature · 1 line
1.7.1
Quoted 5 lines · Frédéric Danis
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
Signature · 2 lines
Frederic Danis Open Source Technology Centre frederic.danis(a)intel.com Intel Corporation