summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo F. Padovan <padovan@profusion.mobi>2010-02-12 21:31:40 -0200
committerDenis Kenzior <denkenz@gmail.com>2010-02-12 17:35:11 -0600
commit4c0790da4fe55084f82b5df4b9d7fe25f1558b0a (patch)
tree2a4c27f73fcf899b443724380a9b5a7be8595441
parenta040ca718b473a07ff4896eca24def70a5c9d8d1 (diff)
downloadofono-4c0790da4fe55084f82b5df4b9d7fe25f1558b0a.tar.bz2
hfp: Don't use Disconnect when agent was released
-rw-r--r--plugins/hfp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 5934bbc7..0b5b53cc 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -952,20 +952,24 @@ 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);
- status = send_method_call_with_reply(BLUEZ_SERVICE,
- data->handsfree_path,
- BLUEZ_GATEWAY_INTERFACE, "Disconnect",
- hfp_power_down, modem, NULL, 15,
- DBUS_TYPE_INVALID);
+ if (g_dbus_unregister_interface(connection, obj_path,
+ HFP_AGENT_INTERFACE)) {
+ status = send_method_call_with_reply(BLUEZ_SERVICE,
+ data->handsfree_path,
+ BLUEZ_GATEWAY_INTERFACE, "Disconnect",
+ hfp_power_down, modem, NULL, 15,
+ DBUS_TYPE_INVALID);
- if (status < 0)
- return -EINVAL;
+ if (status < 0)
+ return -EINVAL;
+ }
return -EINPROGRESS;
}