altair-lte: prevent connect while processing sim refresh
This patch modifies the Altair LTE plugin to fail connect requests while the modem has detached from the network when processing sim refresh.
This commit is contained in:
@@ -196,6 +196,20 @@ connect_3gpp (MMBroadbandBearer *self,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Don't allow a connect while we detach from the network to process SIM
|
||||||
|
* refresh.
|
||||||
|
* */
|
||||||
|
if (mm_broadband_modem_altair_lte_is_sim_refresh_detach_in_progress (modem)) {
|
||||||
|
mm_dbg ("Detached from network to process SIM refresh, failing connect request");
|
||||||
|
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||||
|
callback,
|
||||||
|
user_data,
|
||||||
|
MM_CORE_ERROR,
|
||||||
|
MM_CORE_ERROR_RETRY,
|
||||||
|
"Detached from network to process SIM refresh, can't connect.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
data = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (modem), MM_PORT_TYPE_NET);
|
data = mm_base_modem_peek_best_data_port (MM_BASE_MODEM (modem), MM_PORT_TYPE_NET);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||||
|
@@ -59,6 +59,10 @@ struct _MMBroadbandModemAltairLtePrivate {
|
|||||||
* This indicates that there are no more SIM refreshes and we should
|
* This indicates that there are no more SIM refreshes and we should
|
||||||
* reregister the device.*/
|
* reregister the device.*/
|
||||||
guint sim_refresh_timer_id;
|
guint sim_refresh_timer_id;
|
||||||
|
/* Flag indicating that we are detaching from the network to process SIM
|
||||||
|
* refresh. This is used to prevent connect requests while we're in this
|
||||||
|
* state.*/
|
||||||
|
gboolean sim_refresh_detach_in_progress;
|
||||||
/* Regex for bearer related notifications */
|
/* Regex for bearer related notifications */
|
||||||
GRegex *statcm_regex;
|
GRegex *statcm_regex;
|
||||||
/* Regex for PCO notifications */
|
/* Regex for PCO notifications */
|
||||||
@@ -639,6 +643,7 @@ altair_reregister_ready (MMBaseModem *self,
|
|||||||
} else {
|
} else {
|
||||||
mm_dbg ("Modem reregistered successfully");
|
mm_dbg ("Modem reregistered successfully");
|
||||||
}
|
}
|
||||||
|
MM_BROADBAND_MODEM_ALTAIR_LTE (self)->priv->sim_refresh_detach_in_progress = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -648,6 +653,7 @@ altair_deregister_ready (MMBaseModem *self,
|
|||||||
{
|
{
|
||||||
if (!mm_base_modem_at_command_finish (self, res, NULL)) {
|
if (!mm_base_modem_at_command_finish (self, res, NULL)) {
|
||||||
mm_dbg ("Deregister modem failed");
|
mm_dbg ("Deregister modem failed");
|
||||||
|
MM_BROADBAND_MODEM_ALTAIR_LTE (self)->priv->sim_refresh_detach_in_progress = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -681,6 +687,10 @@ altair_load_own_numbers_ready (MMIfaceModem *iface_modem,
|
|||||||
g_strfreev (str_list);
|
g_strfreev (str_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set this flag to prevent connect requests from being processed while we
|
||||||
|
* detach from the network.*/
|
||||||
|
self->priv->sim_refresh_detach_in_progress = TRUE;
|
||||||
|
|
||||||
/* Deregister */
|
/* Deregister */
|
||||||
mm_dbg ("Reregistering modem");
|
mm_dbg ("Reregistering modem");
|
||||||
mm_base_modem_at_command (
|
mm_base_modem_at_command (
|
||||||
@@ -703,8 +713,8 @@ altair_sim_refresh_timer_expired (MMBroadbandModemAltairLte *self)
|
|||||||
MM_IFACE_MODEM (self),
|
MM_IFACE_MODEM (self),
|
||||||
(GAsyncReadyCallback)altair_load_own_numbers_ready,
|
(GAsyncReadyCallback)altair_load_own_numbers_ready,
|
||||||
self);
|
self);
|
||||||
|
|
||||||
self->priv->sim_refresh_timer_id = 0;
|
self->priv->sim_refresh_timer_id = 0;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1408,6 +1418,12 @@ mm_broadband_modem_altair_lte_new (const gchar *device,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
mm_broadband_modem_altair_lte_is_sim_refresh_detach_in_progress (MMBroadbandModem *self)
|
||||||
|
{
|
||||||
|
return MM_BROADBAND_MODEM_ALTAIR_LTE (self)->priv->sim_refresh_detach_in_progress;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mm_broadband_modem_altair_lte_init (MMBroadbandModemAltairLte *self)
|
mm_broadband_modem_altair_lte_init (MMBroadbandModemAltairLte *self)
|
||||||
{
|
{
|
||||||
@@ -1419,6 +1435,7 @@ mm_broadband_modem_altair_lte_init (MMBroadbandModemAltairLte *self)
|
|||||||
|
|
||||||
self->priv->sim_refresh_regex = g_regex_new ("\\r\\n\\%NOTIFYEV:\\s*SIMREFRESH,?(\\d*)\\r+\\n",
|
self->priv->sim_refresh_regex = g_regex_new ("\\r\\n\\%NOTIFYEV:\\s*SIMREFRESH,?(\\d*)\\r+\\n",
|
||||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
|
||||||
|
self->priv->sim_refresh_detach_in_progress = FALSE;
|
||||||
self->priv->sim_refresh_timer_id = 0;
|
self->priv->sim_refresh_timer_id = 0;
|
||||||
self->priv->statcm_regex = g_regex_new ("\\r\\n\\%STATCM:\\s*(\\d*),?(\\d*)\\r+\\n",
|
self->priv->statcm_regex = g_regex_new ("\\r\\n\\%STATCM:\\s*(\\d*),?(\\d*)\\r+\\n",
|
||||||
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
|
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
|
||||||
|
@@ -48,4 +48,6 @@ MMBroadbandModemAltairLte *mm_broadband_modem_altair_lte_new (const gchar *devic
|
|||||||
guint16 vendor_id,
|
guint16 vendor_id,
|
||||||
guint16 product_id);
|
guint16 product_id);
|
||||||
|
|
||||||
|
gboolean mm_broadband_modem_altair_lte_is_sim_refresh_detach_in_progress (MMBroadbandModem *self);
|
||||||
|
|
||||||
#endif /* MM_BROADBAND_MODEM_ALTAIR_LTE_H */
|
#endif /* MM_BROADBAND_MODEM_ALTAIR_LTE_H */
|
||||||
|
Reference in New Issue
Block a user