I was using hfp_disable directly to shutdown the modem. It's wrong, we
should call ofono_modem_set_powered(modem, FALSE) for that.
---
 plugins/hfp.c |   16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/plugins/hfp.c b/plugins/hfp.c
index 0e2e359..122a336 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -66,7 +66,6 @@ static const char *chld_prefix[] = { "+CHLD:", NULL };
 
 static DBusConnection *connection;
 
-static int hfp_disable(struct ofono_modem *modem);
 static void hfp_remove(struct ofono_modem *modem);
 
 static void hfp_debug(const char *str, void *user_data)
@@ -140,7 +139,7 @@ static void cmer_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        struct hfp_data *data = ofono_modem_get_data(modem);
 
        if (!ok) {
-               hfp_disable(modem);
+               ofono_modem_set_powered(modem, FALSE);
                return;
        }
 
@@ -198,10 +197,9 @@ static gboolean hfp_enable_timeout(gpointer user)
 {
        struct ofono_modem *modem = user;
 
-       if (ofono_modem_get_powered(modem))
-               return FALSE;
+       if (!ofono_modem_get_powered(modem))
+               ofono_modem_set_powered(modem, FALSE);
 
-       hfp_disable(modem);
        return FALSE;
 }
 
@@ -242,7 +240,7 @@ static void cind_status_cb(gboolean ok, GAtResult *result,
        return;
 
 error:
-       hfp_disable(modem);
+       ofono_modem_set_powered(modem, FALSE);
 }
 
 static void cind_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -302,7 +300,7 @@ static void cind_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        return;
 
 error:
-       hfp_disable(modem);
+       ofono_modem_set_powered(modem, FALSE);
 }
 
 static void brsf_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -326,7 +324,7 @@ static void brsf_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
        return;
 
 error:
-       hfp_disable(modem);
+       ofono_modem_set_powered(modem, FALSE);
 }
 
 /* either oFono or Phone could request SLC connection */
@@ -769,8 +767,6 @@ static int hfp_disable(struct ofono_modem *modem)
 
        g_source_remove(data->at_timeout);
 
-       ofono_modem_set_powered(modem, FALSE);
-
        hfp_disconnect_ofono_handsfree(modem);
        return 0;
 }
-- 
1.6.4.4

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to