Skip to contentSkip to conversation

Fix power down of hfpmodem

PATCH New Gustavo F. Padovan 1 participant 2 messages Feb 4, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Fix power down of hfpmodem

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(-)
plugins/hfp.c +6 -10
index 0e2e359..122a336 100644
@@ -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;
 }
Signature · 1 line
1.6.4.4
#1 lore raw

PATCH 2/2 Remove unneeded declaration of hfp_remove()

---
 plugins/hfp.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
plugins/hfp.c +0 -2
index 122a336..7c3ba8e 100644
@@ -66,8 +66,6 @@ static const char *chld_prefix[] = { "+CHLD:", NULL };
 
 static DBusConnection *connection;
 
-static void hfp_remove(struct ofono_modem *modem);
-
 static void hfp_debug(const char *str, void *user_data)
 {
 	ofono_info("%s", str);
Signature · 1 line
1.6.4.4