cinterion: allow recovering automatic mode
When automatic mode (i.e. 2G+3G+none preferred) is selected, we need to explicitly request it by giving the AT+COPS write command with values (i.e. not just empty fields).
This commit is contained in:
@@ -773,13 +773,14 @@ allowed_access_technology_update_ready (MMBroadbandModemCinterion *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_current_modes (MMIfaceModem *self,
|
set_current_modes (MMIfaceModem *_self,
|
||||||
MMModemMode allowed,
|
MMModemMode allowed,
|
||||||
MMModemMode preferred,
|
MMModemMode preferred,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
|
MMBroadbandModemCinterion *self = MM_BROADBAND_MODEM_CINTERION (_self);
|
||||||
|
|
||||||
g_assert (preferred == MM_MODEM_MODE_NONE);
|
g_assert (preferred == MM_MODEM_MODE_NONE);
|
||||||
|
|
||||||
@@ -789,9 +790,9 @@ set_current_modes (MMIfaceModem *self,
|
|||||||
set_current_modes);
|
set_current_modes);
|
||||||
|
|
||||||
/* For dual 2G/3G devices... */
|
/* For dual 2G/3G devices... */
|
||||||
if (mm_iface_modem_is_2g (self) &&
|
if (mm_iface_modem_is_2g (_self) &&
|
||||||
mm_iface_modem_is_3g (self)) {
|
mm_iface_modem_is_3g (_self)) {
|
||||||
GString *cmd;
|
gchar *command;
|
||||||
|
|
||||||
/* We will try to simulate the possible allowed modes here. The
|
/* We will try to simulate the possible allowed modes here. The
|
||||||
* Cinterion devices do not seem to allow setting preferred access
|
* Cinterion devices do not seem to allow setting preferred access
|
||||||
@@ -802,24 +803,31 @@ set_current_modes (MMIfaceModem *self,
|
|||||||
* - for the remaining ones, we default to automatic selection of RAT,
|
* - for the remaining ones, we default to automatic selection of RAT,
|
||||||
* which is based on the quality of the connection.
|
* which is based on the quality of the connection.
|
||||||
*/
|
*/
|
||||||
cmd = g_string_new ("+COPS=,,,");
|
|
||||||
if (allowed == MM_MODEM_MODE_3G) {
|
if (allowed == MM_MODEM_MODE_3G)
|
||||||
g_string_append (cmd, "2");
|
command = g_strdup ("+COPS=,,,2");
|
||||||
} else if (allowed == MM_MODEM_MODE_2G) {
|
else if (allowed == MM_MODEM_MODE_2G)
|
||||||
g_string_append (cmd, "0");
|
command = g_strdup ("+COPS=,,,0");
|
||||||
} else if (allowed == (MM_MODEM_MODE_3G | MM_MODEM_MODE_2G)) {
|
else if (allowed == (MM_MODEM_MODE_3G | MM_MODEM_MODE_2G)) {
|
||||||
/* no AcT given, defaults to Auto */
|
/* no AcT given, defaults to Auto. For this case, we cannot provide
|
||||||
|
* AT+COPS=,,, (i.e. just without a last value). Instead, we need to
|
||||||
|
* re-run the last manual/automatic selection command which succeeded,
|
||||||
|
* (or auto by default if none was launched) */
|
||||||
|
if (self->priv->manual_operator_id)
|
||||||
|
command = g_strdup_printf ("+COPS=1,2,\"%s\"", self->priv->manual_operator_id);
|
||||||
|
else
|
||||||
|
command = g_strdup ("+COPS=0");
|
||||||
} else
|
} else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command (
|
||||||
MM_BASE_MODEM (self),
|
MM_BASE_MODEM (self),
|
||||||
cmd->str,
|
command,
|
||||||
20,
|
20,
|
||||||
FALSE,
|
FALSE,
|
||||||
(GAsyncReadyCallback)allowed_access_technology_update_ready,
|
(GAsyncReadyCallback)allowed_access_technology_update_ready,
|
||||||
result);
|
result);
|
||||||
g_string_free (cmd, TRUE);
|
g_free (command);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user