ModemManager: avoid sending power-up command to Sierra MC8780



Hi hi,

Gerd, Pantelis and me debugged the issue off-list and came up with the
following patch which fixes the issue for Gerd. It will avoid sending
the power-up command to the Sierra MC8780 modem. Probably some other
similar Sierra modems could benefit from the patch, but as we don't
really know which of them, only that specific model is considered.

Comments?

-- 
Aleksander
>From a8ca28b9d1657a7293bcff811e06682920aecdce Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander lanedo com>
Date: Fri, 20 May 2011 11:46:32 +0200
Subject: [PATCH] sierra: avoid sending power-up commanad to Sierra MC8780

Fixes LP#459052

Based on a patch developed by Alexander Sack
---
 plugins/mm-modem-sierra-gsm.c |   45 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/plugins/mm-modem-sierra-gsm.c b/plugins/mm-modem-sierra-gsm.c
index d4636d7..dda1272 100644
--- a/plugins/mm-modem-sierra-gsm.c
+++ b/plugins/mm-modem-sierra-gsm.c
@@ -609,6 +609,44 @@ simple_connect (MMModemSimple *simple,
 /*****************************************************************************/
 
 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_UP_CMD: {
+        guint product_id = 0;
+
+        g_object_get (object,
+                      MM_MODEM_HW_PID, &product_id,
+                      NULL);
+
+        /* Some Sierra modems do a full software reset (including
+         * USB stack) with AT+CFUN=1, so try to avoid that.
+         *   - MC8780 (0x6832)
+         * */
+        if (product_id == 0x6832)
+            g_value_set_string (value, "");
+        else
+            g_value_set_string (value, "+CFUN=1");
+        break;
+    }
+    default:
+        break;
+    }
+}
+
+static void
 modem_init (MMModem *modem_class)
 {
     modem_class->grab_port = grab_port;
@@ -646,6 +684,13 @@ mm_modem_sierra_gsm_class_init (MMModemSierraGsmClass *klass)
     mm_modem_sierra_gsm_parent_class = g_type_class_peek_parent (klass);
     g_type_class_add_private (object_class, sizeof (MMModemSierraGsmPrivate));
 
+    object_class->get_property = get_property;
+    object_class->set_property = set_property;
+
+    g_object_class_override_property (object_class,
+                                      MM_GENERIC_GSM_PROP_POWER_UP_CMD,
+                                      MM_GENERIC_GSM_POWER_UP_CMD);
+
     object_class->dispose = dispose;
     gsm_class->do_enable_power_up_done = real_do_enable_power_up_done;
     gsm_class->set_allowed_mode = set_allowed_mode;
-- 
1.7.4.1



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