* [PATCH 1/2] hfp: add watch to trigger HUP of the file descriptor
@ 2010-02-15 20:40 Gustavo F. Padovan
2010-02-15 20:40 ` [PATCH 2/2] hfp: remove modems if bluetoothd shutdowns without calling Release Gustavo F. Padovan
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2010-02-15 20:40 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
---
plugins/hfp.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 411cfc1..616b119 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -482,6 +482,17 @@ error:
service_level_conn_failed(modem);
}
+static void hfp_disconnected_cb(gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct hfp_data *data = ofono_modem_get_data(modem);
+
+ ofono_modem_set_powered(modem, FALSE);
+
+ g_at_chat_unref(data->chat);
+ data->chat = NULL;
+}
+
/* either oFono or Phone could request SLC connection */
static int service_level_connection(struct ofono_modem *modem, int fd)
{
@@ -506,6 +517,8 @@ static int service_level_connection(struct ofono_modem *modem, int fd)
if (!chat)
return -ENOMEM;
+ g_at_chat_set_disconnect_function(chat, hfp_disconnected_cb, modem);
+
if (getenv("OFONO_AT_DEBUG"))
g_at_chat_set_debug(chat, hfp_debug, NULL);
--
1.6.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] hfp: remove modems if bluetoothd shutdowns without calling Release
2010-02-15 20:40 [PATCH 1/2] hfp: add watch to trigger HUP of the file descriptor Gustavo F. Padovan
@ 2010-02-15 20:40 ` Gustavo F. Padovan
2010-02-15 21:04 ` Denis Kenzior
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo F. Padovan @ 2010-02-15 20:40 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2365 bytes --]
---
plugins/hfp.c | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 616b119..3fa0aa1 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -907,6 +907,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);
@@ -1094,6 +1111,7 @@ static struct ofono_modem_driver hfp_driver = {
.post_sim = hfp_post_sim,
};
+static guint bluetooth_exit_watch;
static guint adapter_added_watch;
static guint adapter_removed_watch;
static guint uuid_watch;
@@ -1107,6 +1125,9 @@ static int hfp_init()
connection = ofono_dbus_get_connection();
+ bluetooth_exit_watch = g_dbus_add_service_watch(connection, BLUEZ_SERVICE,
+ NULL, bluetooth_disconnect, NULL, NULL);
+
adapter_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL,
BLUEZ_MANAGER_INTERFACE,
"AdapterAdded",
@@ -1122,8 +1143,8 @@ static int hfp_init()
"PropertyChanged",
property_changed, NULL, NULL);
- if (adapter_added_watch == 0 || adapter_removed_watch == 0||
- uuid_watch == 0) {
+ if (bluetooth_exit_watch == 0 || adapter_added_watch == 0 ||
+ adapter_removed_watch == 0|| uuid_watch == 0) {
err = -EIO;
goto remove;
}
@@ -1146,6 +1167,7 @@ static int hfp_init()
return 0;
remove:
+ g_dbus_remove_watch(connection, bluetooth_exit_watch);
g_dbus_remove_watch(connection, adapter_added_watch);
g_dbus_remove_watch(connection, adapter_removed_watch);
g_dbus_remove_watch(connection, uuid_watch);
@@ -1161,6 +1183,7 @@ remove:
static void hfp_exit()
{
+ g_dbus_remove_watch(connection, bluetooth_exit_watch);
g_dbus_remove_watch(connection, adapter_added_watch);
g_dbus_remove_watch(connection, adapter_removed_watch);
g_dbus_remove_watch(connection, uuid_watch);
--
1.6.4.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] hfp: remove modems if bluetoothd shutdowns without calling Release
2010-02-15 20:40 ` [PATCH 2/2] hfp: remove modems if bluetoothd shutdowns without calling Release Gustavo F. Padovan
@ 2010-02-15 21:04 ` Denis Kenzior
0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2010-02-15 21:04 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 184 bytes --]
Hi Gustavo,
> ---
> plugins/hfp.c | 27 +++++++++++++++++++++++++--
> 1 files changed, 25 insertions(+), 2 deletions(-)
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-15 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15 20:40 [PATCH 1/2] hfp: add watch to trigger HUP of the file descriptor Gustavo F. Padovan
2010-02-15 20:40 ` [PATCH 2/2] hfp: remove modems if bluetoothd shutdowns without calling Release Gustavo F. Padovan
2010-02-15 21:04 ` Denis Kenzior
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.