Re: ModemManager: new 'iridium' plugin



> This development is ready for review in the 'plugin-iridium' branch in
> the following Gitorious repository [3]:
>    git://gitorious.org/lanedo/modemmanager.git

I finally had time and means to retest the Iridium plugin after Dan's
review some time ago and after fixing some issues related to recent
commits in MM. This plugin is now available in git master, not in MM_05
as it needs RS232-specific support.

I also ported it to the 06-api branch, and it is available in there already.

> 
> The NetworkManager changes needed (just 1 commit) are available in the
> '08-mm-ip-timeout' branch in the following Gitorious repository [4]:
>    git://gitorious.org/lanedo/networkmanager.git
> This branch is based on NM_0_8, but the commit [5] can be cherry-picked
> to git master without conflict.
> 

The patch needed in NetworkManager is attached to this email; can
someone with commit rights push it?

Cheers!

-- 
Aleksander
>From 6959af8d54d25c3490372129a7022e0889b5fc05 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander lanedo com>
Date: Thu, 9 Jun 2011 18:26:33 +0200
Subject: [PATCH] modem-manager: query desired IP timeout value

Different modem implementations in ModemManager are now able to specify specific
maximum durations of the IP configuration setup. This is useful when specific
modems need durations greater than the default 20s (for example, for Satellite
network based modems, where delays are pretty high).
---
 src/modem-manager/nm-modem.c |   45 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/src/modem-manager/nm-modem.c b/src/modem-manager/nm-modem.c
index 33f1078..13b4b64 100644
--- a/src/modem-manager/nm-modem.c
+++ b/src/modem-manager/nm-modem.c
@@ -67,6 +67,7 @@ typedef struct {
 	DBusGProxyCall *call;
 
 	gboolean mm_enabled;
+	guint32 mm_ip_timeout;
 
 	/* PPP stats */
 	guint32 in_bytes;
@@ -232,6 +233,7 @@ ppp_stage3_ip4_config_start (NMModem *self,
 	const char *ppp_name = NULL;
 	GError *error = NULL;
 	NMActStageReturn ret;
+	guint32 ip_timeout;
 
 	g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
 	g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
@@ -247,8 +249,17 @@ ppp_stage3_ip4_config_start (NMModem *self,
 			return NM_ACT_STAGE_RETURN_FAILURE;
 	}
 
+	/* Check if ModemManager requested a specific IP timeout to be used. If 0 reported,
+	 * use the default one (20s) */
+	if (priv->mm_ip_timeout > 0) {
+		nm_log_info (LOGD_PPP, "using modem-specified IP timeout: %u seconds",
+		             priv->mm_ip_timeout);
+		ip_timeout = priv->mm_ip_timeout;
+	} else
+		ip_timeout = 20;
+
 	priv->ppp_manager = nm_ppp_manager_new (priv->iface);
-	if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, 20, &error)) {
+	if (nm_ppp_manager_start (priv->ppp_manager, req, ppp_name, ip_timeout, &error)) {
 		g_signal_connect (priv->ppp_manager, "state-changed",
 						  G_CALLBACK (ppp_state_changed),
 						  self);
@@ -575,7 +586,7 @@ nm_modem_act_stage1_prepare (NMModem *self,
 		if (hints)
 			g_ptr_array_free (hints, TRUE);
 	}
-	
+
 	return ret;
 }
 
@@ -806,6 +817,35 @@ nm_modem_get_path (NMModem *self)
 }
 
 static void
+get_mm_ip_timeout_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
+{
+	NMModem *self = NM_MODEM (user_data);
+	GError *error = NULL;
+	GValue value = { 0, };
+
+	/* On error or if invalid value, just set 0 and we will use the default
+	 * configuration afterwards */
+	if (dbus_g_proxy_end_call (proxy, call_id, &error,
+	                           G_TYPE_VALUE, &value,
+	                           G_TYPE_INVALID) &&
+	    G_VALUE_HOLDS_UINT (&value)) {
+		NM_MODEM_GET_PRIVATE (self)->mm_ip_timeout = g_value_get_uint (&value);
+		g_value_unset (&value);
+	}
+}
+
+static void
+query_mm_ip_timeout (NMModem *self)
+{
+	dbus_g_proxy_begin_call (NM_MODEM_GET_PRIVATE (self)->props_proxy,
+	                         "Get", get_mm_ip_timeout_done,
+	                         self, NULL,
+	                         G_TYPE_STRING, MM_DBUS_INTERFACE_MODEM,
+	                         G_TYPE_STRING, "IpTimeout",
+	                         G_TYPE_INVALID);
+}
+
+static void
 get_mm_enabled_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
 {
 	NMModem *self = NM_MODEM (user_data);
@@ -973,6 +1013,7 @@ constructor (GType type,
 	                             object,
 	                             NULL);
 
+	query_mm_ip_timeout (NM_MODEM (object));
 	query_mm_enabled (NM_MODEM (object));
 
 	return object;
-- 
1.7.5.4



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