Re: Hello, please help with my 3G device



Hey,

>>
>>>> Can you get ModemManager debug logs by following the steps given in
>>>> section "Debugging NetworkManager 0.8 and 0.9 3G connections" of the
>>>> following page?:
>>>> https://live.gnome.org/NetworkManager/Debugging
>>>
>>> Hello, thanks for replying, here's the logs.
>>>
>>
>> The Huawei plugin always starts probing USB interface 0; and it seems
>> that none of the 3 ttyACM ports given has usbif 0, so never starts
>> probing the other ports. The plugin should possibly wait up to N seconds
>> for usbif 0 to appear, and keep on probing normally if it doesn't appear
>> in that time.
>>
>> Will try to prepare a patch for that.
> 
> Great! cannot wait to try :)
> 

Attached is a patch to apply on top of the MM_05 branch of ModemManager:
  $> git clone git://anongit.freedesktop.org/ModemManager/ModemManager
  $> cd ModemManager
  $> git checkout -b MM_05 origin/MM_05
  $> git am /path/to/the/patch.diff
  $> ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var
  $> make
  $> sudo make install

It is not a perfect solution, but should do the trick. I'll find a
better fix for git master/0.7; as I do have some probing improvements
ready there which would help quite a lot also in this case.

Let me know if it worked or not, as I don't have any Huawei modem around
to play with. Please attach debug logs in any case.

Cheers!

-- 
Aleksander


>From d36dcdd2c13f01dafc994d9b60f68e568a8f8ea0 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander lanedo com>
Date: Sun, 15 Jul 2012 18:26:11 +0200
Subject: [PATCH] huawei: limit the number of deferred tasks

The Huawei plugin requires to probe first the USB interface 0; all the other
probing tasks in the remaining ports will get deferred until the interface 0
gets probed. But, some modems (e.g. Huawei ET8282), don't expose the USB
interface 0 as an AT port, so we get an infinite loop as no port ends up being
probed.

In order to fix this, we will limit to a predefined maximum the number of times a given probing task is deferred, 4 in this case. So, if a given probing task is
deferred for more than 4x3s=12s, probing will get forced.
---
 plugins/mm-plugin-huawei.c |   30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/plugins/mm-plugin-huawei.c b/plugins/mm-plugin-huawei.c
index fe7ffa0..d861a37 100644
--- a/plugins/mm-plugin-huawei.c
+++ b/plugins/mm-plugin-huawei.c
@@ -159,6 +159,9 @@ add_regex (MMAtSerialPort *port, const char *match, gpointer user_data)
     g_regex_unref (regex);
 }
 
+#define TAG_DEFER_COUNTS_PREFIX "huawei-defer-counts"
+#define MAX_DEFERS 4
+
 static MMPluginSupportsResult
 supports_port (MMPluginBase *base,
                MMModem *existing,
@@ -198,8 +201,31 @@ supports_port (MMPluginBase *base,
      * we need to use the first port that does respond to probing to create the
      * right type of mode (GSM or CDMA), and then re-check the other interfaces.
      */
-    if (!existing && usbif != 0)
-        return MM_PLUGIN_SUPPORTS_PORT_DEFER;
+    if (!existing && usbif != 0) {
+        gchar *tag;
+        guint n_deferred;
+
+        /* We need to defer the probing as usbif 0 wasn't probed yet. We need to
+         * protect against the case of not having usbif 0 as an AT port, and we
+         * do that by limiting the number of times we defer the probing. */
+
+        tag = g_strdup_printf ("%s-%s/%s", TAG_DEFER_COUNTS_PREFIX, subsys, name);
+        /* First time requested will be 0 */
+        n_deferred = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (base), tag));
+        if (n_deferred < MAX_DEFERS) {
+            /* Update defer count */
+            g_object_set_data (G_OBJECT (base), tag, GUINT_TO_POINTER (n_deferred + 1));
+            g_free (tag);
+            return MM_PLUGIN_SUPPORTS_PORT_DEFER;
+        }
+
+        mm_dbg ("(%s): no longer waiting for usbif 0, will launch probing in interface (%s/%s)",
+                mm_plugin_get_name (MM_PLUGIN (base)), subsys, name);
+        g_free (tag);
+
+        /* Clear tag */
+        g_object_set_data (G_OBJECT (base), tag, NULL);
+    }
 
     /* CDMA devices don't have problems with the secondary ports, so after
      * ensuring we have a device by probing the first port, probe the secondary
-- 
1.7.10.4



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