telit: fix mode 'any' setting with AT commands
When setting mode 'any' with +WS46 command the supported modes should be considered for choosing the at command correct argument.
This commit is contained in:
@@ -63,6 +63,7 @@ load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
GArray *combinations;
|
GArray *combinations;
|
||||||
GArray *filtered;
|
GArray *filtered;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
MMSharedTelit *shared = MM_SHARED_TELIT (self);
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||||
@@ -107,6 +108,7 @@ load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
g_array_unref (all);
|
g_array_unref (all);
|
||||||
g_array_unref (combinations);
|
g_array_unref (combinations);
|
||||||
|
|
||||||
|
mm_shared_telit_store_supported_modes (shared, filtered);
|
||||||
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
|
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
@@ -1267,6 +1267,7 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
GArray *all;
|
GArray *all;
|
||||||
GArray *combinations;
|
GArray *combinations;
|
||||||
GArray *filtered;
|
GArray *filtered;
|
||||||
|
MMSharedTelit *shared = MM_SHARED_TELIT (self);
|
||||||
|
|
||||||
all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
|
all = iface_modem_parent->load_supported_modes_finish (self, res, &error);
|
||||||
if (!all) {
|
if (!all) {
|
||||||
@@ -1288,6 +1289,7 @@ parent_load_supported_modes_ready (MMIfaceModem *self,
|
|||||||
g_array_unref (all);
|
g_array_unref (all);
|
||||||
g_array_unref (combinations);
|
g_array_unref (combinations);
|
||||||
|
|
||||||
|
mm_shared_telit_store_supported_modes (shared, filtered);
|
||||||
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
|
g_task_return_pointer (task, filtered, (GDestroyNotify) g_array_unref);
|
||||||
g_object_unref (task);
|
g_object_unref (task);
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,7 @@ typedef struct {
|
|||||||
gboolean alternate_3g_bands;
|
gboolean alternate_3g_bands;
|
||||||
gboolean ext_4g_bands;
|
gboolean ext_4g_bands;
|
||||||
GArray *supported_bands;
|
GArray *supported_bands;
|
||||||
|
GArray *supported_modes;
|
||||||
} Private;
|
} Private;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -49,6 +50,8 @@ private_free (Private *priv)
|
|||||||
{
|
{
|
||||||
if (priv->supported_bands)
|
if (priv->supported_bands)
|
||||||
g_array_unref (priv->supported_bands);
|
g_array_unref (priv->supported_bands);
|
||||||
|
if (priv->supported_modes)
|
||||||
|
g_array_unref (priv->supported_modes);
|
||||||
g_slice_free (Private, priv);
|
g_slice_free (Private, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,6 +96,16 @@ get_private (MMSharedTelit *self)
|
|||||||
return priv;
|
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) */
|
/* Load current mode (Modem interface) */
|
||||||
|
|
||||||
@@ -531,10 +544,27 @@ mm_shared_telit_set_current_modes (MMIfaceModem *self,
|
|||||||
{
|
{
|
||||||
GTask *task;
|
GTask *task;
|
||||||
gchar *command;
|
gchar *command;
|
||||||
|
Private *priv;
|
||||||
gint ws46_mode = -1;
|
gint ws46_mode = -1;
|
||||||
|
|
||||||
|
priv = get_private (MM_SHARED_TELIT (self));
|
||||||
task = g_task_new (self, NULL, callback, user_data);
|
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)
|
if (allowed == MM_MODEM_MODE_2G)
|
||||||
ws46_mode = 12;
|
ws46_mode = 12;
|
||||||
else if (allowed == MM_MODEM_MODE_3G)
|
else if (allowed == MM_MODEM_MODE_3G)
|
||||||
@@ -550,8 +580,7 @@ mm_shared_telit_set_current_modes (MMIfaceModem *self,
|
|||||||
ws46_mode = 30;
|
ws46_mode = 30;
|
||||||
else if (allowed == (MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
|
else if (allowed == (MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
|
||||||
ws46_mode = 31;
|
ws46_mode = 31;
|
||||||
else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G) ||
|
else if (allowed == (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G | MM_MODEM_MODE_4G))
|
||||||
allowed == MM_MODEM_MODE_ANY)
|
|
||||||
ws46_mode = 25;
|
ws46_mode = 25;
|
||||||
|
|
||||||
/* Telit modems do not support preferred mode selection */
|
/* Telit modems do not support preferred mode selection */
|
||||||
|
@@ -42,6 +42,9 @@ struct _MMSharedTelit {
|
|||||||
|
|
||||||
GType mm_shared_telit_get_type (void);
|
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,
|
gboolean mm_shared_telit_load_current_modes_finish (MMIfaceModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
MMModemMode *allowed,
|
MMModemMode *allowed,
|
||||||
|
Reference in New Issue
Block a user