aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/telit/mm-broadband-modem-mbim-telit.c16
-rw-r--r--plugins/telit/mm-broadband-modem-telit.c10
-rw-r--r--plugins/telit/mm-shared-telit.c39
-rw-r--r--plugins/telit/mm-shared-telit.h3
4 files changed, 52 insertions, 16 deletions
diff --git a/plugins/telit/mm-broadband-modem-mbim-telit.c b/plugins/telit/mm-broadband-modem-mbim-telit.c
index 3ac17bce..97b75755 100644
--- a/plugins/telit/mm-broadband-modem-mbim-telit.c
+++ b/plugins/telit/mm-broadband-modem-mbim-telit.c
@@ -57,13 +57,14 @@ load_supported_modes_ready (MMIfaceModem *self,
{
MMModemModeCombination modes_combination;
MMModemMode modes_mask = MM_MODEM_MODE_NONE;
- const gchar *response;
- GArray *modes;
- GArray *all;
- GArray *combinations;
- GArray *filtered;
- GError *error = NULL;
- guint i;
+ const gchar *response;
+ GArray *modes;
+ GArray *all;
+ GArray *combinations;
+ GArray *filtered;
+ GError *error = NULL;
+ MMSharedTelit *shared = MM_SHARED_TELIT (self);
+ guint i;
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error) {
@@ -107,6 +108,7 @@ load_supported_modes_ready (MMIfaceModem *self,
g_array_unref (all);
g_array_unref (combinations);
+ mm_shared_telit_store_supported_modes (shared, filtered);
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
g_object_unref (task);
}
diff --git a/plugins/telit/mm-broadband-modem-telit.c b/plugins/telit/mm-broadband-modem-telit.c
index 4e8a1912..3dd9ba36 100644
--- a/plugins/telit/mm-broadband-modem-telit.c
+++ b/plugins/telit/mm-broadband-modem-telit.c
@@ -1263,10 +1263,11 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
GAsyncResult *res,
GTask *task)
{
- GError *error = NULL;
- GArray *all;
- GArray *combinations;
- GArray *filtered;
+ GError *error = NULL;
+ GArray *all;
+ GArray *combinations;
+ GArray *filtered;
+ MMSharedTelit *shared = MM_SHARED_TELIT (self);
all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
if (!all) {
@@ -1288,6 +1289,7 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
g_array_unref (all);
g_array_unref (combinations);
+ mm_shared_telit_store_supported_modes (shared, filtered);
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
g_object_unref (task);
}
diff --git a/plugins/telit/mm-shared-telit.c b/plugins/telit/mm-shared-telit.c
index af9dea3d..7f45a639 100644
--- a/plugins/telit/mm-shared-telit.c
+++ b/plugins/telit/mm-shared-telit.c
@@ -42,6 +42,7 @@ typedef struct {
gboolean alternate_3g_bands;
gboolean ext_4g_bands;
GArray *supported_bands;
+ GArray *supported_modes;
} Private;
static void
@@ -49,6 +50,8 @@ private_free (Private *priv)
{
if (priv->supported_bands)
g_array_unref (priv->supported_bands);
+ if (priv->supported_modes)
+ g_array_unref (priv->supported_modes);
g_slice_free (Private, priv);
}
@@ -93,6 +96,16 @@ get_private (MMSharedTelit *self)
return priv;
}
+void
+mm_shared_telit_store_supported_modes (MMSharedTelit *self,
+ GArray *modes)
+{
+ Private *priv;
+
+ priv = get_private (MM_SHARED_TELIT (self));
+ priv->supported_modes = g_array_ref (modes);
+}
+
/*****************************************************************************/
/* Load current mode (Modem interface) */
@@ -529,12 +542,29 @@ mm_shared_telit_set_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
- GTask *task;
- gchar *command;
- gint ws46_mode = -1;
+ GTask *task;
+ gchar *command;
+ Private *priv;
+ gint ws46_mode = -1;
+ priv = get_private (MM_SHARED_TELIT (self));
task = g_task_new (self, NULL, callback, user_data);
+ if (allowed == MM_MODEM_MODE_ANY && priv->supported_modes) {
+ guint i;
+
+ allowed = MM_MODEM_MODE_NONE;
+ /* Process list of modes to gather supported ones */
+ for (i = 0; i < priv->supported_modes->len; i++) {
+ if (g_array_index (priv->supported_modes, MMModemMode, i) & MM_MODEM_MODE_2G)
+ allowed |= MM_MODEM_MODE_2G;
+ if (g_array_index (priv->supported_modes, MMModemMode, i) & MM_MODEM_MODE_3G)
+ allowed |= MM_MODEM_MODE_3G;
+ if (g_array_index (priv->supported_modes, MMModemMode, i) & MM_MODEM_MODE_4G)
+ allowed |= MM_MODEM_MODE_4G;
+ }
+ }
+
if (allowed == MM_MODEM_MODE_2G)
ws46_mode = 12;
else if (allowed == MM_MODEM_MODE_3G)
@@ -550,8 +580,7 @@ mm_shared_telit_set_current_modes (MMIfaceModem *self,
ws46_mode = 30;
else if (allowed == (MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
ws46_mode = 31;
- else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G) ||
- allowed == MM_MODEM_MODE_ANY)
+ else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
ws46_mode = 25;
/* Telit modems do not support preferred mode selection */
diff --git a/plugins/telit/mm-shared-telit.h b/plugins/telit/mm-shared-telit.h
index 4cfaeb51..9981dd9b 100644
--- a/plugins/telit/mm-shared-telit.h
+++ b/plugins/telit/mm-shared-telit.h
@@ -42,6 +42,9 @@ struct _MMSharedTelit {
GType mm_shared_telit_get_type (void);
+void mm_shared_telit_store_supported_modes (MMSharedTelit *self,
+ GArray *modes);
+
gboolean mm_shared_telit_load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res,
MMModemMode *allowed,