diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-02-12 20:10:29 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-02-12 20:10:29 -0600 |
commit | 766a0bcfa50069dbdfe7ddae7018e963e73f95ec (patch) | |
tree | d4f9030a9ab32ada013d2c15dffcd24e9cd3ff27 | |
parent | 7194bd03a0846a09741ef71429d578cf6728d76a (diff) | |
download | ofono-766a0bcfa50069dbdfe7ddae7018e963e73f95ec.tar.bz2 |
Fix: Unregistering the agent in disable is wrong
What we really want to do here is set a flag that the agent has not been
released yet. If this is the case we should send the Disconnect call on
disable.
-rw-r--r-- | drivers/hfpmodem/hfpmodem.h | 1 | ||||
-rw-r--r-- | plugins/hfp.c | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h index 6ec8a7ce..c95ea3fd 100644 --- a/drivers/hfpmodem/hfpmodem.h +++ b/drivers/hfpmodem/hfpmodem.h @@ -71,6 +71,7 @@ struct hfp_data { unsigned int hf_features; unsigned char cind_pos[HFP_INDICATOR_LAST]; unsigned int cind_val[HFP_INDICATOR_LAST]; + gboolean agent_registered; }; extern void hfp_netreg_init(); diff --git a/plugins/hfp.c b/plugins/hfp.c index 1349d2d9..2d039736 100644 --- a/plugins/hfp.c +++ b/plugins/hfp.c @@ -544,9 +544,11 @@ static DBusMessage *hfp_agent_release(DBusConnection *conn, DBusMessage *msg, void *data) { struct ofono_modem *modem = data; + struct hfp_data *hfp_data = ofono_modem_get_data(modem); const char *obj_path = ofono_modem_get_path(modem); g_dbus_unregister_interface(connection, obj_path, HFP_AGENT_INTERFACE); + hfp_data->agent_registered = FALSE; ofono_modem_remove(modem); @@ -931,6 +933,8 @@ static int hfp_probe(struct ofono_modem *modem) g_dbus_register_interface(connection, obj_path, HFP_AGENT_INTERFACE, agent_methods, NULL, NULL, modem, NULL); + data->agent_registered = TRUE; + if (hfp_register_ofono_handsfree(modem) != 0) return -EINVAL; @@ -1033,15 +1037,13 @@ done: static int hfp_disable(struct ofono_modem *modem) { struct hfp_data *data = ofono_modem_get_data(modem); - const char *obj_path = ofono_modem_get_path(modem); int status; DBG("%p", modem); clear_data(modem); - if (g_dbus_unregister_interface(connection, obj_path, - HFP_AGENT_INTERFACE)) { + if (data->agent_registered) { status = send_method_call_with_reply(BLUEZ_SERVICE, data->handsfree_path, BLUEZ_GATEWAY_INTERFACE, "Disconnect", |