[PATCH] ModemManager: Icera CID handling without an APN



In mm-generic-gsm.c, if an APN is not provided as a property to simple_connect(), priv->cid is never set and remains at -1.
The Icera modem plugin has a _get_cid() wrapper call which checks for this and returns 0 if the stored CID is -1. There are two problems with this:
  * 0 is not a valid CID; according to 3GPP 27.007, CIDs have a minimum value of 1. Thus, if an APN was not provided, the plugin issues commands like %IPDPCFG and %IPDPACT with CID=0, which the modem rejects.
  * connection_enabled() uses the priv->cid value rather than the _get_cid() wrapped value, and bails out if it's -1, so a connection is never acknowledged and the modem remains in "connecting" state.

I've attached a patch that (I think) fixes this, by having _get_cid() return 1 and having connection_enabled() use it instead of mm_generic_gsm_get_cid(); however, I have a feeling that the way it works now is deliberate and I'm missing something about how the no-APN case is supposed to work.
Thoughts? Or, if this analysis seems correct, the patch should be ready to go.

    - Nathan

From eb1dd980ab495274599e2e87483ba84e91048fa6 Mon Sep 17 00:00:00 2001
From: Nathan Williams <njw chromium org>
Date: Thu, 12 May 2011 18:50:33 -0400
Subject: [PATCH] _get_cid(): return a usable cid (1) rather than an unusable one (0).
 connection_enabled(): use _get_cid() instead of mm_generic_gsm_get_cid().

Change-Id: Ib7c0bfd0d5da5b8cbbac81cce1dda185a556e20a
---
 plugins/mm-modem-icera.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/plugins/mm-modem-icera.c b/plugins/mm-modem-icera.c
index d34e71e..0589088 100644
--- a/plugins/mm-modem-icera.c
+++ b/plugins/mm-modem-icera.c
@@ -333,6 +333,19 @@ icera_disconnect_done (MMModem *modem,
     mm_info ("Modem signaled disconnection from the network");
 }
 
+static gint
+_get_cid (MMModemIcera *self)
+{
+    gint cid;
+
+    cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (self));
+    if (cid < 0) {
+        g_warn_if_fail (cid >= 0);
+        cid = 1;
+    }
+    return cid;
+}
+
 static void
 connection_enabled (MMAtSerialPort *port,
                     GMatchInfo *match_info,
@@ -344,9 +357,7 @@ connection_enabled (MMAtSerialPort *port,
     char *str;
     int status, cid, tmp;
 
-    cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (self));
-    if (cid < 0)
-        return;
+    cid = _get_cid (self);
 
     str = g_match_info_fetch (match_info, 1);
     g_return_if_fail (str != NULL);
@@ -392,19 +403,6 @@ connection_enabled (MMAtSerialPort *port,
 
 /****************************************************************/
 
-static gint
-_get_cid (MMModemIcera *self)
-{
-    gint cid;
-
-    cid = mm_generic_gsm_get_cid (MM_GENERIC_GSM (self));
-    if (cid < 0) {
-        g_warn_if_fail (cid >= 0);
-        cid = 0;
-    }
-    return cid;
-}
-
 static void
 icera_call_control (MMModemIcera *self,
                     gboolean activate,
-- 
1.7.3.1



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