diff options
author | Denis Kenzior <denkenz@gmail.com> | 2013-02-13 20:14:32 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2013-02-14 08:47:10 -0600 |
commit | 825feb8cd52345bc950aa7906db17de41bfcd3a9 (patch) | |
tree | 7f6eb33a67039176b4d5761cd1533e27e8de2113 /plugins/hfp_hf_bluez5.c | |
parent | 69820a7136c7d7925bfb5c4f725e481cb642ba5f (diff) | |
download | ofono-825feb8cd52345bc950aa7906db17de41bfcd3a9.tar.bz2 |
hfp_hf_bluez5: Use faster method of disable()
Diffstat (limited to 'plugins/hfp_hf_bluez5.c')
-rw-r--r-- | plugins/hfp_hf_bluez5.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c index 43acd998..ca20bfc0 100644 --- a/plugins/hfp_hf_bluez5.c +++ b/plugins/hfp_hf_bluez5.c @@ -248,21 +248,26 @@ static int hfp_enable(struct ofono_modem *modem) static int hfp_disable(struct ofono_modem *modem) { - const char *path; + struct hfp *hfp = ofono_modem_get_data(modem); + struct hfp_slc_info *info = &hfp->info; + GIOChannel *channel; + int fd; DBG("%p", modem); - path = ofono_modem_get_string(modem, "DevicePath"); - /* - * We call Device1.DisconnectProfile() for the connection to be - * dropped, which will cause the profile RequestDisconnection() method - * to be called which will bring the modem down + * Instead of triggering two round trips to BlueZ (DisconnectProfile, + * RequestDisconnection) simply kill the connection on the RFCOMM fd + * we already have. But for this we have to call shutdown(). */ - bt_disconnect_profile(ofono_dbus_get_connection(), path, HFP_AG_UUID, - NULL, NULL); + channel = g_at_chat_get_channel(info->chat); + fd = g_io_channel_unix_get_fd(channel); + shutdown(fd, SHUT_RDWR); - return -EINPROGRESS; + g_at_chat_unref(info->chat); + info->chat = NULL; + + return 0; } static void hfp_pre_sim(struct ofono_modem *modem) |