[PATCH 1/2] broadband-modem-mbim: allow "max_sessions" bearers

Bjørn Mork bjorn at mork.no
Thu Jun 5 04:51:14 PDT 2014


Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
 src/mm-broadband-modem-mbim.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/src/mm-broadband-modem-mbim.c b/src/mm-broadband-modem-mbim.c
index f842a37..dda4ea6 100644
--- a/src/mm-broadband-modem-mbim.c
+++ b/src/mm-broadband-modem-mbim.c
@@ -143,6 +143,44 @@ modem_load_current_capabilities_finish (MMIfaceModem *self,
 }
 
 static void
+bearer_list_updated (MMBearerList *bearer_list,
+                     GParamSpec *pspec,
+                     MMIfaceModem *self)
+{
+    MmGdbusModem *skeleton;
+    gchar **paths;
+
+    g_object_get (self, MM_IFACE_MODEM_DBUS_SKELETON, &skeleton, NULL);
+    if (!skeleton)
+        return;
+
+    paths = mm_bearer_list_get_paths (bearer_list);
+    mm_gdbus_modem_set_bearers (skeleton, (const gchar *const *)paths);
+    g_strfreev (paths);
+
+    g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (skeleton));
+}
+
+static void
+modem_create_bearer_list (MMBroadbandModemMbim *self)
+{
+    MMBearerList *list = NULL;
+
+    g_object_get (self, MM_IFACE_MODEM_BEARER_LIST, &list, NULL);
+    if (!list) {
+        guint n = self->priv->caps_max_sessions;
+
+        mm_dbg ("Modem allows up to %u bearers", n);
+        list = mm_bearer_list_new (n, n);
+        g_signal_connect (list, "notify::" MM_BEARER_LIST_NUM_BEARERS,
+                          G_CALLBACK (bearer_list_updated),
+                          self);
+        g_object_set (self, MM_IFACE_MODEM_BEARER_LIST, list, NULL);
+    }
+    g_object_unref (list);
+}
+
+static void
 device_caps_query_ready (MbimDevice *device,
                          GAsyncResult *res,
                          LoadCapabilitiesContext *ctx)
@@ -180,6 +218,7 @@ device_caps_query_ready (MbimDevice *device,
         g_simple_async_result_set_op_res_gpointer (ctx->result,
                                                    GUINT_TO_POINTER (mask),
                                                    NULL);
+        modem_create_bearer_list (ctx->self);
     } else
         g_simple_async_result_take_error (ctx->result, error);
 
-- 
2.0.0



More information about the ModemManager-devel mailing list