Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/3] hfp: remove modems if bluetoothd shutdowns without calling Release
Date: Mon, 15 Feb 2010 13:41:08 -0600	[thread overview]
Message-ID: <201002151341.08715.denkenz@gmail.com> (raw)
In-Reply-To: <1266261996-15507-3-git-send-email-padovan@profusion.mobi>

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

Hi Gustavo,

> ---
>  plugins/hfp.c |   28 ++++++++++++++++++++++++++--
>  1 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/plugins/hfp.c b/plugins/hfp.c
> index 3776dc6..c63e332 100644
> --- a/plugins/hfp.c
> +++ b/plugins/hfp.c
> @@ -911,6 +911,23 @@ done:
>  	dbus_message_unref(reply);
>  }
> 
> +static gboolean hfp_remove_each_modem(gpointer key, gpointer value,
>  gpointer user_data) +{
> +	struct ofono_modem *modem = value;
> +
> +	ofono_modem_remove(modem);
> +
> +	return TRUE;
> +}
> +
> +static void bluetooth_disconnect(DBusConnection *connection, void
>  *user_data) +{
> +	if (uuid_hash == NULL)
> +		return;
> +
> +	g_hash_table_foreach_remove(uuid_hash, hfp_remove_each_modem, NULL);
> +}
> +
>  static int hfp_register_ofono_handsfree(struct ofono_modem *modem)
>  {
>  	const char *obj_path = ofono_modem_get_path(modem);
> @@ -1098,6 +1115,7 @@ static struct ofono_modem_driver hfp_driver = {
>  	.post_sim	= hfp_post_sim,
>  };
> 
> +static guint watch;

Rename this into something more sensible, e.g. bluetoothd_exit_watch

>  static guint adapter_added_watch;
>  static guint adapter_removed_watch;
>  static guint uuid_watch;
> @@ -1111,6 +1129,10 @@ static int hfp_init()
> 
>  	connection = ofono_dbus_get_connection();
> 
> +	watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
> +			NULL, bluetooth_disconnect, NULL, NULL);
> +
> +

Why the extra line?

>  	adapter_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
>  						BLUEZ_MANAGER_INTERFACE,
>  						"AdapterAdded",
> @@ -1126,8 +1148,8 @@ static int hfp_init()
>  						"PropertyChanged",
>  						property_changed, NULL, NULL);
> 
> -	if (adapter_added_watch == 0 || adapter_removed_watch == 0||
> -			uuid_watch == 0) {
> +	if (watch == 0 || adapter_added_watch == 0 ||
> +			adapter_removed_watch == 0|| uuid_watch == 0) {
>  		err = -EIO;
>  		goto remove;
>  	}
> @@ -1150,6 +1172,7 @@ static int hfp_init()
>  	return 0;
> 
>  remove:
> +	g_dbus_remove_watch(connection, watch);
>  	g_dbus_remove_watch(connection, adapter_added_watch);
>  	g_dbus_remove_watch(connection, adapter_removed_watch);
>  	g_dbus_remove_watch(connection, uuid_watch);
> @@ -1165,6 +1188,7 @@ remove:
> 
>  static void hfp_exit()
>  {
> +	g_dbus_remove_watch(connection, watch);
>  	g_dbus_remove_watch(connection, adapter_added_watch);
>  	g_dbus_remove_watch(connection, adapter_removed_watch);
>  	g_dbus_remove_watch(connection, uuid_watch);
> 

Regards,
-Denis

  reply	other threads:[~2010-02-15 19:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-15 19:26 [PATCH 1/3] hfp: remove duplicated ofono_modem_set_powered Gustavo F. Padovan
2010-02-15 19:26 ` [PATCH 2/3] hfp: add watch to trigger HUP of the file descriptor Gustavo F. Padovan
2010-02-15 19:26   ` [PATCH 3/3] hfp: remove modems if bluetoothd shutdowns without calling Release Gustavo F. Padovan
2010-02-15 19:41     ` Denis Kenzior [this message]
2010-02-15 19:36   ` [PATCH 2/3] hfp: add watch to trigger HUP of the file descriptor Denis Kenzior
2010-02-15 19:39 ` [PATCH 1/3] hfp: remove duplicated ofono_modem_set_powered Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002151341.08715.denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox