Re: [MM master] Re: [MM06] [PATCH] sierra: use +CFUN=4 for powering down



Den 30. okt. 2012 18:54, skrev Dan Williams:
On Tue, 2012-10-30 at 18:07 +0100, Marius Kotsbak wrote:
Den 09. sep. 2012 21:56, skrev Marius Kotsbak:
Den 09. sep. 2012 17:39, skrev Marius Kotsbak:
See patch attached.

sierra: use +CFUN=4 for powering down

  plugins/mm-modem-sierra-gsm.c |   32 ++++++++++++++++++++++++++++++++
  1 file changed, 32 insertions(+)
See attached patch to avoid that this change causes reset when changing
to cfun=1 (as we avoid running +cfun=1 if it is already in mode 1 and
with this change it will be in mode 4).
Pushed, thanks!  Bonus points for a patch for MM_06?  You'll have to
override MM_GENERIC_GSM_PROP_POWER_UP_CMD like plugins/mm-modem-nokia.c
does by implementing get_property/set_property in the sierra plugin but
that's about it.

Of course, already done, attached! :)

--
Marius



Dan


>From 2ec4e4efcde67403f6bbaa1fc218f5416a12dc77 Mon Sep 17 00:00:00 2001
From: "Marius B. Kotsbak" <marius kotsbak com>
Date: Tue, 30 Oct 2012 18:31:52 +0100
Subject: [PATCH 2/2] sierra: avoid reset when setting cfun=1

Some Sierra modems trigger a reset of the modem when sending +cfun=1,
which is more likely when +cfun=4 is used for powering down since +cfun=1 is
skipped if mode is already 1. All sierra modems supports a second parameter
to indicate that no reset is to be done: "+cfun=1,0".
---
 plugins/mm-modem-sierra-gsm.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index b4f5b15..3737bf5 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -1090,6 +1090,10 @@ get_property (GObject *object,
         /* Use AT+CFUN=4 for power down (low power mode) */
         g_value_set_string (value, "+CFUN=4");
         break;
+    case MM_GENERIC_GSM_PROP_POWER_UP_CMD:
+        /* Use AT+CFUN=1,0 for power up, to avoid reset that +cfun=1 can trigger in some modems */
+        g_value_set_string (value, "+CFUN=1,0");
+        break;
     default:
         break;
     }
@@ -1112,6 +1116,10 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass)
                                       MM_GENERIC_GSM_PROP_POWER_DOWN_CMD,
                                       MM_GENERIC_GSM_POWER_DOWN_CMD);
 
+    g_object_class_override_property (object_class,
+                                      MM_GENERIC_GSM_PROP_POWER_UP_CMD,
+                                      MM_GENERIC_GSM_POWER_UP_CMD);
+
     gsm_class->port_grabbed = port_grabbed;
     gsm_class->do_enable_power_up_check_needed = do_enable_power_up_check_needed;
     gsm_class->do_enable_power_up_done = real_do_enable_power_up_done;
-- 
1.7.10.4

>From d4b07afb7ef8a576ae7b54255d201a90fd52c438 Mon Sep 17 00:00:00 2001
From: "Marius B. Kotsbak" <marius kotsbak com>
Date: Sun, 9 Sep 2012 16:17:46 +0200
Subject: [PATCH 1/2] sierra: use +CFUN=4 for powering down

---
 plugins/mm-modem-sierra-gsm.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index 7a241b3..b4f5b15 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -1071,6 +1071,31 @@ dispose (GObject *object)
 }
 
 static void
+set_property (GObject *object,
+              guint prop_id,
+              const GValue *value,
+              GParamSpec *pspec)
+{
+    /* Do nothing... see set_property() in parent, which also does nothing */
+}
+
+static void
+get_property (GObject *object,
+              guint prop_id,
+              GValue *value,
+              GParamSpec *pspec)
+{
+    switch (prop_id) {
+    case MM_GENERIC_GSM_PROP_POWER_DOWN_CMD:
+        /* Use AT+CFUN=4 for power down (low power mode) */
+        g_value_set_string (value, "+CFUN=4");
+        break;
+    default:
+        break;
+    }
+}
+
+static void
 mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1080,6 +1105,13 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass)
     g_type_class_add_private (object_class, sizeof (MMModemSierraGsmPrivate));
 
     object_class->dispose = dispose;
+    object_class->get_property = get_property;
+    object_class->set_property = set_property;
+
+    g_object_class_override_property (object_class,
+                                      MM_GENERIC_GSM_PROP_POWER_DOWN_CMD,
+                                      MM_GENERIC_GSM_POWER_DOWN_CMD);
+
     gsm_class->port_grabbed = port_grabbed;
     gsm_class->do_enable_power_up_check_needed = do_enable_power_up_check_needed;
     gsm_class->do_enable_power_up_done = real_do_enable_power_up_done;
-- 
1.7.10.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]