In the past we did this dirty hack to quickly fix HFP for the release, now
fixing it in a proper way.
---
 drivers/hfpmodem/hfpmodem.h |    1 -
 plugins/hfp.c               |   12 +++---------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h
index c95ea3f..6ec8a7c 100644
--- a/drivers/hfpmodem/hfpmodem.h
+++ b/drivers/hfpmodem/hfpmodem.h
@@ -71,7 +71,6 @@ 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 e37c9fc..b253781 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -552,11 +552,9 @@ 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);
 
@@ -950,16 +948,10 @@ static int hfp_unregister_ofono_handsfree(struct 
ofono_modem *modem)
 static int hfp_probe(struct ofono_modem *modem)
 {
        const char *obj_path = ofono_modem_get_path(modem);
-       struct hfp_data *data = ofono_modem_get_data(modem);
-
-       if (!data)
-               return -EINVAL;
 
        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;
 
@@ -1062,13 +1054,15 @@ 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 (data->agent_registered) {
+       if (g_dbus_interface_is_registered(connection, obj_path,
+                                               HFP_AGENT_INTERFACE)) {
                status = send_method_call_with_reply(BLUEZ_SERVICE,
                                        data->handsfree_path,
                                        BLUEZ_GATEWAY_INTERFACE, "Disconnect",
-- 
1.7.1

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to