core, plugins: if modem removed don't process response
We try to avoid a memory leak when info->error is reset, as well as a second re-schedule of the info.
This commit is contained in:
@@ -128,6 +128,11 @@ evdo_state_done (MMAtSerialPort *port,
|
|||||||
GRegex *r;
|
GRegex *r;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
/* Leave superclass' reg state alone if AT*HSTATE isn't supported */
|
/* Leave superclass' reg state alone if AT*HSTATE isn't supported */
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
@@ -195,6 +200,11 @@ state_done (MMAtSerialPort *port,
|
|||||||
GRegex *r;
|
GRegex *r;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
/* Leave superclass' reg state alone if AT*STATE isn't supported */
|
/* Leave superclass' reg state alone if AT*STATE isn't supported */
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
|
@@ -63,6 +63,11 @@ get_string_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error && response && !strcmp (response->str, "ERROR")) {
|
if (error && response && !strcmp (response->str, "ERROR")) {
|
||||||
info->error = g_error_new_literal (MM_MOBILE_ERROR,
|
info->error = g_error_new_literal (MM_MOBILE_ERROR,
|
||||||
MM_MOBILE_ERROR_SIM_NOT_INSERTED,
|
MM_MOBILE_ERROR_SIM_NOT_INSERTED,
|
||||||
|
@@ -117,8 +117,16 @@ auth_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemHso *self = MM_MODEM_HSO (info->modem);
|
MMModemHso *self;
|
||||||
MMModemHsoPrivate *priv = MM_MODEM_HSO_GET_PRIVATE (self);
|
MMModemHsoPrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_HSO (info->modem);
|
||||||
|
priv = MM_MODEM_HSO_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
priv->auth_idx++;
|
priv->auth_idx++;
|
||||||
@@ -257,6 +265,11 @@ hso_call_control_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error && !mm_callback_info_get_data (info, IGNORE_ERRORS_TAG))
|
if (error && !mm_callback_info_get_data (info, IGNORE_ERRORS_TAG))
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -318,12 +331,13 @@ hso_enabled (MMModem *modem,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GError *tmp_error;
|
|
||||||
|
|
||||||
tmp_error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (tmp_error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), tmp_error, info);
|
return;
|
||||||
g_clear_error (&tmp_error);
|
|
||||||
|
if (error) {
|
||||||
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), error, info);
|
||||||
} else {
|
} else {
|
||||||
MMModemHsoPrivate *priv = MM_MODEM_HSO_GET_PRIVATE (modem);
|
MMModemHsoPrivate *priv = MM_MODEM_HSO_GET_PRIVATE (modem);
|
||||||
|
|
||||||
@@ -338,13 +352,14 @@ old_context_clear_done (MMModem *modem,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GError *tmp_error;
|
|
||||||
|
|
||||||
tmp_error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (tmp_error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), tmp_error, info);
|
return;
|
||||||
g_clear_error (&tmp_error);
|
|
||||||
} else {
|
if (error)
|
||||||
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), error, info);
|
||||||
|
else {
|
||||||
/* Success, activate the PDP context and start the data session */
|
/* Success, activate the PDP context and start the data session */
|
||||||
hso_call_control (MM_MODEM_HSO (modem), TRUE, FALSE, hso_enabled, info);
|
hso_call_control (MM_MODEM_HSO (modem), TRUE, FALSE, hso_enabled, info);
|
||||||
}
|
}
|
||||||
@@ -356,12 +371,13 @@ connect_auth_done (MMModem *modem,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GError *tmp_error;
|
|
||||||
|
|
||||||
tmp_error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (tmp_error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), tmp_error, info);
|
return;
|
||||||
g_clear_error (&tmp_error);
|
|
||||||
|
if (error) {
|
||||||
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (modem), error, info);
|
||||||
} else {
|
} else {
|
||||||
/* Now connect; kill any existing connections first */
|
/* Now connect; kill any existing connections first */
|
||||||
hso_call_control (MM_MODEM_HSO (modem), FALSE, TRUE, old_context_clear_done, info);
|
hso_call_control (MM_MODEM_HSO (modem), FALSE, TRUE, old_context_clear_done, info);
|
||||||
@@ -491,6 +507,11 @@ get_ip4_config_done (MMAtSerialPort *port,
|
|||||||
guint32 tmp;
|
guint32 tmp;
|
||||||
gint cid;
|
gint cid;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
@@ -560,7 +581,14 @@ disconnect_owancall_done (MMAtSerialPort *port,
|
|||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
mm_callback_info_schedule ((MMCallbackInfo *) user_data);
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -167,6 +167,11 @@ sysinfo_done (MMAtSerialPort *port,
|
|||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
const char *reply;
|
const char *reply;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
/* Leave superclass' reg state alone if AT^SYSINFO isn't supported */
|
/* Leave superclass' reg state alone if AT^SYSINFO isn't supported */
|
||||||
goto done;
|
goto done;
|
||||||
|
@@ -171,6 +171,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -232,11 +237,18 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
|
MMModemHuaweiGsm *self;
|
||||||
int mode_a, mode_b, u1, u2;
|
int mode_a, mode_b, u1, u2;
|
||||||
guint32 band;
|
guint32 band;
|
||||||
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_HUAWEI_GSM (info->modem);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, &mode))
|
else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, &mode))
|
||||||
@@ -271,8 +283,16 @@ set_band_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
|
MMModemHuaweiGsm *self;
|
||||||
MMModemHuaweiGsmPrivate *priv = MM_MODEM_HUAWEI_GSM_GET_PRIVATE (self);
|
MMModemHuaweiGsmPrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_HUAWEI_GSM (info->modem);
|
||||||
|
priv = MM_MODEM_HUAWEI_GSM_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
@@ -321,10 +341,17 @@ get_band_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemHuaweiGsm *self = MM_MODEM_HUAWEI_GSM (info->modem);
|
MMModemHuaweiGsm *self;
|
||||||
int mode_a, mode_b, u1, u2;
|
int mode_a, mode_b, u1, u2;
|
||||||
guint32 band;
|
guint32 band;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_HUAWEI_GSM (info->modem);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, NULL)) {
|
else if (parse_syscfg (self, response->str, &mode_a, &mode_b, &band, &u1, &u2, NULL)) {
|
||||||
@@ -410,6 +437,11 @@ get_act_request_done (MMAtSerialPort *port,
|
|||||||
char *str;
|
char *str;
|
||||||
int srv_stat = 0;
|
int srv_stat = 0;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -504,6 +536,11 @@ send_huawei_cpin_done (MMAtSerialPort *port,
|
|||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
guint32 num = 0;
|
guint32 num = 0;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
@@ -56,6 +56,11 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (!g_str_has_prefix (response->str, "%IPSYS: ")) {
|
else if (!g_str_has_prefix (response->str, "%IPSYS: ")) {
|
||||||
@@ -119,6 +124,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -235,8 +245,14 @@ get_nwstate_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
MMModemIcera *self = MM_MODEM_ICERA (info->modem);
|
MMModemIcera *self = MM_MODEM_ICERA (info->modem);
|
||||||
MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self);
|
MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self);
|
||||||
|
|
||||||
@@ -277,7 +293,14 @@ disconnect_ipdpact_done (MMAtSerialPort *port,
|
|||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
mm_callback_info_schedule ((MMCallbackInfo *) user_data);
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -458,6 +481,11 @@ icera_connected (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
} else {
|
} else {
|
||||||
@@ -481,6 +509,11 @@ old_context_clear_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Activate the PDP context and start the data session */
|
/* Activate the PDP context and start the data session */
|
||||||
icera_call_control (MM_MODEM_ICERA (info->modem), TRUE, icera_connected, info);
|
icera_call_control (MM_MODEM_ICERA (info->modem), TRUE, icera_connected, info);
|
||||||
}
|
}
|
||||||
@@ -493,6 +526,11 @@ auth_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
else {
|
else {
|
||||||
@@ -574,6 +612,11 @@ get_ip4_config_done (MMAtSerialPort *port,
|
|||||||
guint32 tmp;
|
guint32 tmp;
|
||||||
gint cid;
|
gint cid;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
@@ -710,8 +753,14 @@ is_icera_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else
|
||||||
mm_callback_info_set_result (info, GUINT_TO_POINTER (TRUE), NULL);
|
mm_callback_info_set_result (info, GUINT_TO_POINTER (TRUE), NULL);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
@@ -104,6 +104,11 @@ linktop_set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -142,6 +147,11 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (!g_str_has_prefix (response->str, "CFUN: ")) {
|
else if (!g_str_has_prefix (response->str, "CFUN: ")) {
|
||||||
|
@@ -60,9 +60,15 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
||||||
gint mododr = -1;
|
gint mododr = -1;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
p = mm_strip_tag (response->str, "+MODODR:");
|
p = mm_strip_tag (response->str, "+MODODR:");
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -120,6 +126,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -175,6 +186,11 @@ get_act_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
|
@@ -177,6 +177,11 @@ mbm_set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -257,6 +262,11 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (!g_str_has_prefix (response->str, "CFUN: ")) {
|
else if (!g_str_has_prefix (response->str, "CFUN: ")) {
|
||||||
@@ -351,6 +361,11 @@ mbm_enable_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Start unsolicited signal strength and access technology responses */
|
/* Start unsolicited signal strength and access technology responses */
|
||||||
mm_at_serial_port_queue_command (port, "*ERINFO=1", 3, NULL, NULL);
|
mm_at_serial_port_queue_command (port, "*ERINFO=1", 3, NULL, NULL);
|
||||||
|
|
||||||
@@ -364,9 +379,16 @@ mbm_enap0_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
MMModemMbmPrivate *priv;
|
||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
if (!priv->network_mode)
|
if (!priv->network_mode)
|
||||||
priv->network_mode = MBM_NETWORK_MODE_ANY;
|
priv->network_mode = MBM_NETWORK_MODE_ANY;
|
||||||
|
|
||||||
@@ -382,7 +404,14 @@ mbm_init_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
MMModemMbmPrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
@@ -408,12 +437,19 @@ mbm_emrdy_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
|
if (g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_RESPONSE_TIMEOUT))
|
||||||
mm_warn ("timed out waiting for EMRDY response.");
|
mm_warn ("timed out waiting for EMRDY response.");
|
||||||
else
|
else {
|
||||||
|
MMModemMbmPrivate *priv = MM_MODEM_MBM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
priv->have_emrdy = TRUE;
|
priv->have_emrdy = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
do_init (port, info);
|
do_init (port, info);
|
||||||
}
|
}
|
||||||
@@ -536,6 +572,11 @@ factory_reset_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
mm_serial_port_close (MM_SERIAL_PORT (port));
|
mm_serial_port_close (MM_SERIAL_PORT (port));
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
@@ -659,6 +700,11 @@ enap_poll_response (MMAtSerialPort *port,
|
|||||||
|
|
||||||
g_assert (info);
|
g_assert (info);
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
count = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "mbm-enap-poll-count"));
|
count = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "mbm-enap-poll-count"));
|
||||||
|
|
||||||
if (sscanf (response->str, "*ENAP: %d", &state) == 1 && state == 1) {
|
if (sscanf (response->str, "*ENAP: %d", &state) == 1 && state == 1) {
|
||||||
@@ -702,6 +748,11 @@ enap_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
guint tid;
|
guint tid;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
@@ -796,6 +847,11 @@ send_epin_done (MMAtSerialPort *port,
|
|||||||
const char *pin_type;
|
const char *pin_type;
|
||||||
int attempts_left = 0;
|
int attempts_left = 0;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
@@ -122,16 +122,15 @@ get_rssi_done (MMAtSerialPort *port,
|
|||||||
MMModemCdma *parent_iface;
|
MMModemCdma *parent_iface;
|
||||||
int qual;
|
int qual;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (info->modem) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
/* Fallback to parent's method */
|
/* Fallback to parent's method */
|
||||||
g_clear_error (&info->error);
|
|
||||||
parent_iface = g_type_interface_peek_parent (MM_MODEM_CDMA_GET_INTERFACE (info->modem));
|
parent_iface = g_type_interface_peek_parent (MM_MODEM_CDMA_GET_INTERFACE (info->modem));
|
||||||
parent_iface->get_signal_quality (MM_MODEM_CDMA (info->modem), parent_csq_done, info);
|
parent_iface->get_signal_quality (MM_MODEM_CDMA (info->modem), parent_csq_done, info);
|
||||||
} else
|
|
||||||
mm_callback_info_schedule (info);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,6 +118,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -227,8 +232,14 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
parse_nwrat_response (response, &mode, &info->error);
|
parse_nwrat_response (response, &mode, &info->error);
|
||||||
mm_callback_info_set_result (info, GUINT_TO_POINTER (mode), NULL);
|
mm_callback_info_set_result (info, GUINT_TO_POINTER (mode), NULL);
|
||||||
}
|
}
|
||||||
@@ -265,6 +276,11 @@ get_act_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
|
@@ -32,6 +32,11 @@ option_get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (!g_str_has_prefix (response->str, "_OPSYS: ")) {
|
else if (!g_str_has_prefix (response->str, "_OPSYS: ")) {
|
||||||
@@ -95,6 +100,11 @@ option_set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -357,9 +367,15 @@ unsolicited_msg_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
if (info)
|
if (info) {
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
mm_callback_info_chain_complete_one (info);
|
mm_callback_info_chain_complete_one (info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
option_change_unsolicited_messages (MMGenericGsm *modem,
|
option_change_unsolicited_messages (MMGenericGsm *modem,
|
||||||
@@ -394,6 +410,11 @@ get_act_octi_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech octi = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech octi = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
MMModemGsmAccessTech owcti;
|
MMModemGsmAccessTech owcti;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (parse_octi_response (response, &octi)) {
|
if (parse_octi_response (response, &octi)) {
|
||||||
/* If no 3G tech yet or current tech isn't 3G, then 2G tech is the best */
|
/* If no 3G tech yet or current tech isn't 3G, then 2G tech is the best */
|
||||||
@@ -416,6 +437,11 @@ get_act_owcti_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech owcti = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech owcti = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
p = mm_strip_tag (response->str, "_OWCTI:");
|
p = mm_strip_tag (response->str, "_OWCTI:");
|
||||||
if (owcti_to_mm (*p, &owcti)) {
|
if (owcti_to_mm (*p, &owcti)) {
|
||||||
|
@@ -144,6 +144,11 @@ set_band_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -232,6 +237,11 @@ get_band_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemGsmBand mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
MMModemGsmBand mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (parse_ipbm (response->str, &mm_band))
|
else if (parse_ipbm (response->str, &mm_band))
|
||||||
@@ -290,6 +300,11 @@ send_samsung_pinnum_done (MMAtSerialPort *port,
|
|||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
guint32 num = 0;
|
guint32 num = 0;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -461,7 +476,14 @@ init_all_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
MMModemSamsungGsm *self;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
||||||
|
|
||||||
if (!error)
|
if (!error)
|
||||||
mm_modem_icera_change_unsolicited_messages (MM_MODEM_ICERA (self), TRUE);
|
mm_modem_icera_change_unsolicited_messages (MM_MODEM_ICERA (self), TRUE);
|
||||||
@@ -476,7 +498,14 @@ init2_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
MMModemSamsungGsm *self;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
|
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
|
||||||
@@ -493,7 +522,14 @@ init_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemSamsungGsm *self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
MMModemSamsungGsm *self;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_SAMSUNG_GSM (info->modem);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
|
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (self), error, info);
|
||||||
|
@@ -148,7 +148,7 @@ status_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemSierraCdmaPrivate *priv = MM_MODEM_SIERRA_CDMA_GET_PRIVATE (info->modem);
|
MMModemSierraCdmaPrivate *priv;
|
||||||
char **lines, **iter;
|
char **lines, **iter;
|
||||||
gboolean registered = FALSE;
|
gboolean registered = FALSE;
|
||||||
gboolean have_sid = FALSE;
|
gboolean have_sid = FALSE;
|
||||||
@@ -156,6 +156,13 @@ status_done (MMAtSerialPort *port,
|
|||||||
SysMode sys_mode = SYS_MODE_UNKNOWN;
|
SysMode sys_mode = SYS_MODE_UNKNOWN;
|
||||||
gboolean evdo_roam = FALSE, cdma1x_roam = FALSE;
|
gboolean evdo_roam = FALSE, cdma1x_roam = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_MODEM_SIERRA_CDMA_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
/* Leave superclass' reg state alone if AT!STATUS isn't supported */
|
/* Leave superclass' reg state alone if AT!STATUS isn't supported */
|
||||||
goto done;
|
goto done;
|
||||||
@@ -340,10 +347,17 @@ pcstate_done (MMAtSerialPort *port,
|
|||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Ignore errors for now; we're not sure if all Sierra CDMA devices support
|
/* Ignore errors for now; we're not sure if all Sierra CDMA devices support
|
||||||
* at!pcstate.
|
* at!pcstate.
|
||||||
*/
|
*/
|
||||||
mm_callback_info_schedule ((MMCallbackInfo *) user_data);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -74,9 +74,15 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
GRegex *r = NULL;
|
GRegex *r = NULL;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
/* Example response: !SELRAT: 03, UMTS 3G Preferred */
|
/* Example response: !SELRAT: 03, UMTS 3G Preferred */
|
||||||
r = g_regex_new ("!SELRAT:\\s*(\\d+).*$", 0, 0, NULL);
|
r = g_regex_new ("!SELRAT:\\s*(\\d+).*$", 0, 0, NULL);
|
||||||
@@ -156,6 +162,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -217,6 +228,11 @@ get_act_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -260,6 +276,11 @@ get_sim_iccid_done (MMAtSerialPort *port,
|
|||||||
char buf[21];
|
char buf[21];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -415,7 +436,13 @@ ppp_connect_done (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,6 +454,11 @@ net_activate_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_connect_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,6 +473,11 @@ auth_done (MMAtSerialPort *port,
|
|||||||
gint cid;
|
gint cid;
|
||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
@@ -467,6 +504,11 @@ ps_attach_done (MMAtSerialPort *port,
|
|||||||
MMModem *parent_modem_iface;
|
MMModem *parent_modem_iface;
|
||||||
const char *number;
|
const char *number;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
|
@@ -67,9 +67,15 @@ get_mode_pref_done (MMAtSerialPort *port,
|
|||||||
guint32 acqord;
|
guint32 acqord;
|
||||||
MMModemGsmAllowedMode allowed = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
MMModemGsmAllowedMode allowed = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
p = mm_strip_tag (response->str, "+CNMP:");
|
p = mm_strip_tag (response->str, "+CNMP:");
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -125,9 +131,15 @@ get_acq_order_done (MMAtSerialPort *port,
|
|||||||
const char *p;
|
const char *p;
|
||||||
gint acqord = -1;
|
gint acqord = -1;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
p = mm_strip_tag (response->str, "+CNAOP:");
|
p = mm_strip_tag (response->str, "+CNAOP:");
|
||||||
if (!p) {
|
if (!p) {
|
||||||
@@ -182,6 +194,11 @@ set_acq_order_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -198,8 +215,13 @@ set_mode_pref_done (MMAtSerialPort *port,
|
|||||||
guint32 naop;
|
guint32 naop;
|
||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -286,8 +308,13 @@ get_act_tech_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -239,12 +239,19 @@ set_band_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else
|
else {
|
||||||
|
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
priv->current_bands = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-band"));
|
priv->current_bands = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-band"));
|
||||||
|
}
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
@@ -389,11 +396,16 @@ get_2g_band_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
|
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
guint32 mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
guint32 mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
||||||
|
|
||||||
@@ -430,11 +442,16 @@ get_3g_band_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
|
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
guint mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
guint mm_band = MM_MODEM_GSM_BAND_UNKNOWN;
|
||||||
guint32 wavecom_band;
|
guint32 wavecom_band;
|
||||||
@@ -516,6 +533,11 @@ get_access_technology_cb (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -583,19 +605,26 @@ get_allowed_mode_cb (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
MMModemWavecomGsmPrivate *priv;
|
||||||
gint read_mode = -1;
|
gint read_mode = -1;
|
||||||
gchar *mode_str = NULL;
|
gchar *mode_str = NULL;
|
||||||
gchar *prefer_str = NULL;
|
gchar *prefer_str = NULL;
|
||||||
GRegex *r = NULL;
|
GRegex *r = NULL;
|
||||||
GMatchInfo *match_info = NULL;
|
GMatchInfo *match_info = NULL;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
/* Possible responses:
|
/* Possible responses:
|
||||||
* +WWSM: 0 (2G only)
|
* +WWSM: 0 (2G only)
|
||||||
* +WWSM: 1 (3G only)
|
* +WWSM: 1 (3G only)
|
||||||
@@ -706,12 +735,19 @@ set_allowed_mode_cb (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else
|
else {
|
||||||
|
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
priv->allowed_mode = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-mode"));
|
priv->allowed_mode = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-mode"));
|
||||||
|
}
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
@@ -813,17 +849,24 @@ set_highest_ms_class_cb (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
|
||||||
guint new_class;
|
guint new_class;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_class = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-class"));
|
new_class = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "new-class"));
|
||||||
if (new_class)
|
if (new_class) {
|
||||||
|
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
priv->current_ms_class = new_class;
|
priv->current_ms_class = new_class;
|
||||||
|
}
|
||||||
|
|
||||||
/* All done without errors! */
|
/* All done without errors! */
|
||||||
mm_dbg ("[5/5] All done");
|
mm_dbg ("[5/5] All done");
|
||||||
@@ -882,14 +925,21 @@ get_current_ms_class_cb (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
MMModemWavecomGsmPrivate *priv;
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
p = mm_strip_tag (response->str, "+CGCLASS:");
|
p = mm_strip_tag (response->str, "+CGCLASS:");
|
||||||
|
|
||||||
if (strncmp (p,
|
if (strncmp (p,
|
||||||
@@ -936,14 +986,21 @@ get_supported_ms_classes_cb (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemWavecomGsmPrivate *priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
MMModemWavecomGsmPrivate *priv;
|
||||||
const gchar *p;
|
const gchar *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
priv = MM_MODEM_WAVECOM_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
/* Reset currently supported MS classes */
|
/* Reset currently supported MS classes */
|
||||||
priv->supported_ms_classes = 0;
|
priv->supported_ms_classes = 0;
|
||||||
|
|
||||||
@@ -996,6 +1053,11 @@ get_current_functionality_status_cb (MMAtSerialPort *port,
|
|||||||
const gchar *p;
|
const gchar *p;
|
||||||
GError *inner_error;
|
GError *inner_error;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
@@ -1027,6 +1089,11 @@ do_enable_power_up_done (MMGenericGsm *gsm,
|
|||||||
MMAtSerialPort *port;
|
MMAtSerialPort *port;
|
||||||
GError *inner_error = NULL;
|
GError *inner_error = NULL;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
enable_complete (gsm, error, info);
|
enable_complete (gsm, error, info);
|
||||||
return;
|
return;
|
||||||
|
@@ -115,8 +115,14 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
MMModemGsmAllowedMode mode = MM_MODEM_GSM_ALLOWED_MODE_ANY;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
parse_syssel_response (response, &mode, &info->error);
|
parse_syssel_response (response, &mode, &info->error);
|
||||||
mm_callback_info_set_result (info, GUINT_TO_POINTER (mode), NULL);
|
mm_callback_info_set_result (info, GUINT_TO_POINTER (mode), NULL);
|
||||||
}
|
}
|
||||||
@@ -151,7 +157,14 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -103,9 +103,15 @@ get_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
GRegex *r = NULL;
|
GRegex *r = NULL;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
r = g_regex_new ("+ZSNT:\\s*(\\d),(\\d),(\\d)", G_REGEX_UNGREEDY, 0, NULL);
|
r = g_regex_new ("+ZSNT:\\s*(\\d),(\\d),(\\d)", G_REGEX_UNGREEDY, 0, NULL);
|
||||||
if (!r) {
|
if (!r) {
|
||||||
@@ -192,6 +198,11 @@ set_allowed_mode_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -260,6 +271,11 @@ get_act_request_done (MMAtSerialPort *port,
|
|||||||
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
MMModemGsmAccessTech act = MM_MODEM_GSM_ACCESS_TECH_UNKNOWN;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -346,7 +362,14 @@ cpms_try_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (info->modem);
|
MMModemZtePrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_MODEM_ZTE_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
if (error && g_error_matches (error, MM_MOBILE_ERROR, MM_MOBILE_ERROR_SIM_BUSY)) {
|
if (error && g_error_matches (error, MM_MOBILE_ERROR, MM_MOBILE_ERROR_SIM_BUSY)) {
|
||||||
if (priv->cpms_tries++ < 4) {
|
if (priv->cpms_tries++ < 4) {
|
||||||
@@ -377,6 +400,11 @@ init_modem_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
mm_at_serial_port_queue_command (port, "E0", 5, NULL, NULL);
|
mm_at_serial_port_queue_command (port, "E0", 5, NULL, NULL);
|
||||||
|
|
||||||
/* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that
|
/* Attempt to disable floods of "+ZUSIMR:2" unsolicited responses that
|
||||||
@@ -417,8 +445,16 @@ pre_init_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemZte *self = MM_MODEM_ZTE (info->modem);
|
MMModemZte *self;
|
||||||
MMModemZtePrivate *priv = MM_MODEM_ZTE_GET_PRIVATE (self);
|
MMModemZtePrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_MODEM_ZTE (info->modem);
|
||||||
|
priv = MM_MODEM_ZTE_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
/* Retry the init string one more time; the modem sometimes throws it away */
|
/* Retry the init string one more time; the modem sometimes throws it away */
|
||||||
|
@@ -182,6 +182,14 @@ mm_callback_info_get_data (MMCallbackInfo *info, const char *key)
|
|||||||
return quark ? g_datalist_id_get_data (&info->qdata, quark) : NULL;
|
return quark ? g_datalist_id_get_data (&info->qdata, quark) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
mm_callback_info_check_modem_removed (MMCallbackInfo *info)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (info != NULL, TRUE);
|
||||||
|
|
||||||
|
return (info->modem ? FALSE : TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
MMCallbackInfo *
|
MMCallbackInfo *
|
||||||
mm_callback_info_ref (MMCallbackInfo *info)
|
mm_callback_info_ref (MMCallbackInfo *info)
|
||||||
{
|
{
|
||||||
|
@@ -70,6 +70,8 @@ void mm_callback_info_set_data (MMCallbackInfo *info,
|
|||||||
gpointer mm_callback_info_get_data (MMCallbackInfo *info,
|
gpointer mm_callback_info_get_data (MMCallbackInfo *info,
|
||||||
const char *key);
|
const char *key);
|
||||||
|
|
||||||
|
gboolean mm_callback_info_check_modem_removed (MMCallbackInfo *info);
|
||||||
|
|
||||||
MMCallbackInfo *mm_callback_info_ref (MMCallbackInfo *info);
|
MMCallbackInfo *mm_callback_info_ref (MMCallbackInfo *info);
|
||||||
void mm_callback_info_unref (MMCallbackInfo *info);
|
void mm_callback_info_unref (MMCallbackInfo *info);
|
||||||
|
|
||||||
|
@@ -619,6 +619,11 @@ init_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
mm_modem_set_state (MM_MODEM (info->modem),
|
mm_modem_set_state (MM_MODEM (info->modem),
|
||||||
MM_MODEM_STATE_DISABLED,
|
MM_MODEM_STATE_DISABLED,
|
||||||
@@ -699,9 +704,13 @@ disable_all_done (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (modem)
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
disable_set_previous_state (modem, info);
|
disable_set_previous_state (modem, info);
|
||||||
} else {
|
} else {
|
||||||
MMGenericCdma *self = MM_GENERIC_CDMA (info->modem);
|
MMGenericCdma *self = MM_GENERIC_CDMA (info->modem);
|
||||||
@@ -725,9 +734,14 @@ disable_flash_done (MMSerialPort *port,
|
|||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMGenericCdma *self;
|
MMGenericCdma *self;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (info->modem)
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
disable_set_previous_state (info->modem, info);
|
disable_set_previous_state (info->modem, info);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
@@ -787,9 +801,13 @@ dial_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (info->modem)
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
update_enabled_state (MM_GENERIC_CDMA (info->modem), FALSE, MM_MODEM_STATE_REASON_NONE);
|
update_enabled_state (MM_GENERIC_CDMA (info->modem), FALSE, MM_MODEM_STATE_REASON_NONE);
|
||||||
} else {
|
} else {
|
||||||
MMGenericCdma *self = MM_GENERIC_CDMA (info->modem);
|
MMGenericCdma *self = MM_GENERIC_CDMA (info->modem);
|
||||||
@@ -831,15 +849,19 @@ disconnect_flash_done (MMSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemState prev_state;
|
MMModemState prev_state;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (info->modem) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
/* Reset old state since the operation failed */
|
/* Reset old state since the operation failed */
|
||||||
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_CDMA_PREV_STATE_TAG));
|
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_CDMA_PREV_STATE_TAG));
|
||||||
mm_modem_set_state (MM_MODEM (info->modem),
|
mm_modem_set_state (MM_MODEM (info->modem),
|
||||||
prev_state,
|
prev_state,
|
||||||
MM_MODEM_STATE_REASON_NONE);
|
MM_MODEM_STATE_REASON_NONE);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mm_port_set_connected (MM_GENERIC_CDMA_GET_PRIVATE (info->modem)->data, FALSE);
|
mm_port_set_connected (MM_GENERIC_CDMA_GET_PRIVATE (info->modem)->data, FALSE);
|
||||||
update_enabled_state (MM_GENERIC_CDMA (info->modem), FALSE, MM_MODEM_STATE_REASON_NONE);
|
update_enabled_state (MM_GENERIC_CDMA (info->modem), FALSE, MM_MODEM_STATE_REASON_NONE);
|
||||||
@@ -929,6 +951,11 @@ get_signal_quality_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
char *reply = response->str;
|
char *reply = response->str;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (mm_callback_info_get_data (info, CSQ2_TRIED))
|
if (mm_callback_info_get_data (info, CSQ2_TRIED))
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
@@ -1077,6 +1104,11 @@ get_string_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -1207,6 +1239,11 @@ serving_system_done (MMAtSerialPort *port,
|
|||||||
unsigned char band = 'Z';
|
unsigned char band = 'Z';
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
@@ -1500,8 +1537,14 @@ subclass_reg_query_done (MMModemCdma *cdma,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
/* Set final registration state */
|
/* Set final registration state */
|
||||||
set_callback_1x_state_helper (info, cdma_reg_state);
|
set_callback_1x_state_helper (info, cdma_reg_state);
|
||||||
set_callback_evdo_state_helper (info, evdo_reg_state);
|
set_callback_evdo_state_helper (info, evdo_reg_state);
|
||||||
@@ -1520,6 +1563,11 @@ reg_query_speri_done (MMAtSerialPort *port,
|
|||||||
gboolean roam = FALSE;
|
gboolean roam = FALSE;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
@@ -1559,6 +1607,11 @@ reg_query_spservice_done (MMAtSerialPort *port,
|
|||||||
MMModemCdmaRegistrationState cdma_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
MMModemCdmaRegistrationState cdma_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
MMModemCdmaRegistrationState evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
MMModemCdmaRegistrationState evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (mm_cdma_parse_spservice_response (response->str, &cdma_state, &evdo_state)) {
|
else if (mm_cdma_parse_spservice_response (response->str, &cdma_state, &evdo_state)) {
|
||||||
@@ -1661,6 +1714,11 @@ get_analog_digital_done (MMAtSerialPort *port,
|
|||||||
const char *reply;
|
const char *reply;
|
||||||
long int int_cad;
|
long int int_cad;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -2030,9 +2088,14 @@ simple_state_machine (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
const char *str;
|
const char *str;
|
||||||
guint id;
|
guint id;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (info->error)
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case SIMPLE_STATE_BEGIN:
|
case SIMPLE_STATE_BEGIN:
|
||||||
|
@@ -275,6 +275,11 @@ pin_check_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (response && strstr (response->str, "+CPIN: ")) {
|
else if (response && strstr (response->str, "+CPIN: ")) {
|
||||||
@@ -513,6 +518,11 @@ real_get_iccid_done (MMAtSerialPort *port,
|
|||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
char buf[21], swapped[21];
|
char buf[21], swapped[21];
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -1064,12 +1074,13 @@ cgreg1_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->modem) {
|
* scheduling callback */
|
||||||
if (info->error) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
return;
|
||||||
|
|
||||||
g_clear_error (&info->error);
|
if (error) {
|
||||||
|
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
/* The modem doesn't like unsolicited CGREG, so we'll need to poll */
|
/* The modem doesn't like unsolicited CGREG, so we'll need to poll */
|
||||||
priv->cgreg_poll = TRUE;
|
priv->cgreg_poll = TRUE;
|
||||||
@@ -1078,7 +1089,6 @@ cgreg1_done (MMAtSerialPort *port,
|
|||||||
|
|
||||||
/* Success; get initial state */
|
/* Success; get initial state */
|
||||||
mm_at_serial_port_queue_command (port, "+CGREG?", 10, reg_poll_response, info->modem);
|
mm_at_serial_port_queue_command (port, "+CGREG?", 10, reg_poll_response, info->modem);
|
||||||
}
|
|
||||||
|
|
||||||
initial_unsolicited_reg_check_done (info);
|
initial_unsolicited_reg_check_done (info);
|
||||||
}
|
}
|
||||||
@@ -1091,11 +1101,13 @@ cgreg2_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
/* Ignore errors except modem removal errors */
|
/* If the modem has already been removed, return without
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
* scheduling callback */
|
||||||
if (info->modem) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
if (info->error) {
|
return;
|
||||||
g_clear_error (&info->error);
|
|
||||||
|
/* Ignore errors */
|
||||||
|
if (error) {
|
||||||
/* Try CGREG=1 instead */
|
/* Try CGREG=1 instead */
|
||||||
mm_at_serial_port_queue_command (port, "+CGREG=1", 3, cgreg1_done, info);
|
mm_at_serial_port_queue_command (port, "+CGREG=1", 3, cgreg1_done, info);
|
||||||
} else {
|
} else {
|
||||||
@@ -1109,10 +1121,6 @@ cgreg2_done (MMAtSerialPort *port,
|
|||||||
/* All done */
|
/* All done */
|
||||||
initial_unsolicited_reg_check_done (info);
|
initial_unsolicited_reg_check_done (info);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Modem got removed */
|
|
||||||
mm_callback_info_schedule (info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1122,14 +1130,16 @@ creg1_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->modem) {
|
* scheduling callback */
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (info->error) {
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
g_clear_error (&info->error);
|
|
||||||
|
|
||||||
|
if (error) {
|
||||||
/* The modem doesn't like unsolicited CREG, so we'll need to poll */
|
/* The modem doesn't like unsolicited CREG, so we'll need to poll */
|
||||||
priv->creg_poll = TRUE;
|
priv->creg_poll = TRUE;
|
||||||
} else
|
} else
|
||||||
@@ -1140,10 +1150,6 @@ creg1_done (MMAtSerialPort *port,
|
|||||||
|
|
||||||
/* Now try to set up CGREG messages */
|
/* Now try to set up CGREG messages */
|
||||||
mm_at_serial_port_queue_command (port, "+CGREG=2", 3, cgreg2_done, info);
|
mm_at_serial_port_queue_command (port, "+CGREG=2", 3, cgreg2_done, info);
|
||||||
} else {
|
|
||||||
/* Modem got removed */
|
|
||||||
mm_callback_info_schedule (info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1154,13 +1160,15 @@ creg2_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
/* Ignore errors except modem removal errors */
|
/* If the modem has already been removed, return without
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
* scheduling callback */
|
||||||
if (info->modem) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
if (info->error) {
|
return;
|
||||||
g_clear_error (&info->error);
|
|
||||||
|
/* Ignore errors */
|
||||||
|
if (error)
|
||||||
mm_at_serial_port_queue_command (port, "+CREG=1", 3, creg1_done, info);
|
mm_at_serial_port_queue_command (port, "+CREG=1", 3, creg1_done, info);
|
||||||
} else {
|
else {
|
||||||
add_loc_capability (MM_GENERIC_GSM (info->modem), MM_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI);
|
add_loc_capability (MM_GENERIC_GSM (info->modem), MM_MODEM_LOCATION_CAPABILITY_GSM_LAC_CI);
|
||||||
|
|
||||||
mm_callback_info_set_data (info, CREG_NUM_TAG, GUINT_TO_POINTER (2), NULL);
|
mm_callback_info_set_data (info, CREG_NUM_TAG, GUINT_TO_POINTER (2), NULL);
|
||||||
@@ -1171,10 +1179,6 @@ creg2_done (MMAtSerialPort *port,
|
|||||||
/* Now try to set up CGREG messages */
|
/* Now try to set up CGREG messages */
|
||||||
mm_at_serial_port_queue_command (port, "+CGREG=2", 3, cgreg2_done, info);
|
mm_at_serial_port_queue_command (port, "+CGREG=2", 3, cgreg2_done, info);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
/* Modem got removed */
|
|
||||||
mm_callback_info_schedule (info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1182,9 +1186,13 @@ enable_failed (MMModem *modem, GError *error, MMCallbackInfo *info)
|
|||||||
{
|
{
|
||||||
MMGenericGsmPrivate *priv;
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* If modem already removed, do nothing */
|
||||||
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
if (modem) {
|
|
||||||
mm_modem_set_state (modem,
|
mm_modem_set_state (modem,
|
||||||
MM_MODEM_STATE_DISABLED,
|
MM_MODEM_STATE_DISABLED,
|
||||||
MM_MODEM_STATE_REASON_NONE);
|
MM_MODEM_STATE_REASON_NONE);
|
||||||
@@ -1195,7 +1203,6 @@ enable_failed (MMModem *modem, GError *error, MMCallbackInfo *info)
|
|||||||
mm_serial_port_close_force (MM_SERIAL_PORT (priv->primary));
|
mm_serial_port_close_force (MM_SERIAL_PORT (priv->primary));
|
||||||
if (priv->secondary && mm_serial_port_is_open (MM_SERIAL_PORT (priv->secondary)))
|
if (priv->secondary && mm_serial_port_is_open (MM_SERIAL_PORT (priv->secondary)))
|
||||||
mm_serial_port_close_force (MM_SERIAL_PORT (priv->secondary));
|
mm_serial_port_close_force (MM_SERIAL_PORT (priv->secondary));
|
||||||
}
|
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
@@ -1468,6 +1475,11 @@ enable_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Let subclasses handle the power up command response/error; many devices
|
/* Let subclasses handle the power up command response/error; many devices
|
||||||
* don't support +CFUN, but for those that do let them handle the error
|
* don't support +CFUN, but for those that do let them handle the error
|
||||||
* correctly.
|
* correctly.
|
||||||
@@ -1488,6 +1500,11 @@ init_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
mm_generic_gsm_enable_complete (MM_GENERIC_GSM (info->modem), error, info);
|
||||||
return;
|
return;
|
||||||
@@ -1590,8 +1607,14 @@ disable_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
MMGenericGsm *self = MM_GENERIC_GSM (info->modem);
|
MMGenericGsm *self = MM_GENERIC_GSM (info->modem);
|
||||||
|
|
||||||
mm_serial_port_close_force (MM_SERIAL_PORT (port));
|
mm_serial_port_close_force (MM_SERIAL_PORT (port));
|
||||||
@@ -1623,15 +1646,19 @@ disable_flash_done (MMSerialPort *port,
|
|||||||
MMModemState prev_state;
|
MMModemState prev_state;
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
if (info->modem) {
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
/* Reset old state since the operation failed */
|
/* Reset old state since the operation failed */
|
||||||
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_GSM_PREV_STATE_TAG));
|
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_GSM_PREV_STATE_TAG));
|
||||||
mm_modem_set_state (MM_MODEM (info->modem),
|
mm_modem_set_state (MM_MODEM (info->modem),
|
||||||
prev_state,
|
prev_state,
|
||||||
MM_MODEM_STATE_REASON_NONE);
|
MM_MODEM_STATE_REASON_NONE);
|
||||||
}
|
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
@@ -1739,6 +1766,11 @@ get_string_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else
|
else
|
||||||
@@ -1760,6 +1792,11 @@ get_mnc_length_done (MMAtSerialPort *port,
|
|||||||
char hex[51];
|
char hex[51];
|
||||||
char *bin;
|
char *bin;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -2016,35 +2053,33 @@ static void
|
|||||||
pin_puk_recheck_done (MMModem *modem, GError *error, gpointer user_data)
|
pin_puk_recheck_done (MMModem *modem, GError *error, gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
MMGenericGsmPrivate *priv;
|
||||||
MMSerialPort *port;
|
MMSerialPort *port;
|
||||||
GError *saved_error;
|
GError *saved_error;
|
||||||
|
|
||||||
|
/* Do nothing if modem removed */
|
||||||
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
/* Clear the pin check timeout to ensure that it won't ever get a
|
/* Clear the pin check timeout to ensure that it won't ever get a
|
||||||
* stale MMCallbackInfo if the modem got removed. We'll reschedule it here
|
* stale MMCallbackInfo if the modem got removed. We'll reschedule it here
|
||||||
* anyway if needed.
|
* anyway if needed.
|
||||||
*/
|
*/
|
||||||
if (info->modem) {
|
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
|
||||||
if (priv->pin_check_timeout)
|
if (priv->pin_check_timeout)
|
||||||
g_source_remove (priv->pin_check_timeout);
|
g_source_remove (priv->pin_check_timeout);
|
||||||
priv->pin_check_timeout = 0;
|
priv->pin_check_timeout = 0;
|
||||||
}
|
|
||||||
|
|
||||||
/* modem could have been removed before we get here, in which case
|
/* Propagate the error to the info */
|
||||||
* 'modem' will be NULL.
|
if (error)
|
||||||
*/
|
info->error = g_error_copy (error);
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
|
||||||
|
|
||||||
/* If the modem wasn't removed, and the modem isn't ready yet, ask it for
|
/* If the modem wasn't removed, and the modem isn't ready yet, ask it for
|
||||||
* the current PIN status a few times since some devices take a bit to fully
|
* the current PIN status a few times since some devices take a bit to fully
|
||||||
* enable themselves after a SIM PIN/PUK unlock.
|
* enable themselves after a SIM PIN/PUK unlock.
|
||||||
*/
|
*/
|
||||||
if ( info->modem
|
if (info->error && !g_error_matches (info->error, MM_MODEM_ERROR, MM_MODEM_ERROR_REMOVED)) {
|
||||||
&& info->error
|
|
||||||
&& !g_error_matches (info->error, MM_MODEM_ERROR, MM_MODEM_ERROR_REMOVED)) {
|
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
|
||||||
|
|
||||||
if (priv->pin_check_tries < 4) {
|
if (priv->pin_check_tries < 4) {
|
||||||
g_clear_error (&info->error);
|
g_clear_error (&info->error);
|
||||||
priv->pin_check_tries++;
|
priv->pin_check_tries++;
|
||||||
@@ -2055,13 +2090,13 @@ pin_puk_recheck_done (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
|
|
||||||
/* Otherwise, clean up and return the PIN check result */
|
/* Otherwise, clean up and return the PIN check result */
|
||||||
port = mm_callback_info_get_data (info, PIN_PORT_TAG);
|
port = mm_callback_info_get_data (info, PIN_PORT_TAG);
|
||||||
if (modem && port)
|
if (port)
|
||||||
mm_serial_port_close (port);
|
mm_serial_port_close (port);
|
||||||
|
|
||||||
/* If we have a saved error from sending PIN/PUK, return that to callers */
|
/* If we have a saved error from sending PIN/PUK, return that to callers */
|
||||||
saved_error = mm_callback_info_get_data (info, SAVED_ERROR_TAG);
|
saved_error = mm_callback_info_get_data (info, SAVED_ERROR_TAG);
|
||||||
if (saved_error) {
|
if (saved_error) {
|
||||||
if (info->modem && !mm_modem_base_get_unlock_required (MM_MODEM_BASE (info->modem))) {
|
if (!mm_modem_base_get_unlock_required (MM_MODEM_BASE (info->modem))) {
|
||||||
/* Original unlock failed but the modem is actually unlocked, so
|
/* Original unlock failed but the modem is actually unlocked, so
|
||||||
* return success. Sometimes happens if the modem doesn't allow
|
* return success. Sometimes happens if the modem doesn't allow
|
||||||
* CPIN="xxxx" when it's already unlocked and returns an error.
|
* CPIN="xxxx" when it's already unlocked and returns an error.
|
||||||
@@ -2085,6 +2120,11 @@ send_puk_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error->domain != MM_MOBILE_ERROR) {
|
if (error->domain != MM_MOBILE_ERROR) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
@@ -2149,6 +2189,11 @@ send_pin_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error->domain != MM_MOBILE_ERROR) {
|
if (error->domain != MM_MOBILE_ERROR) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
@@ -2212,6 +2257,11 @@ enable_pin_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
@@ -2242,6 +2292,11 @@ change_pin_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
@@ -2734,11 +2789,19 @@ get_reg_status_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMGenericGsm *self = MM_GENERIC_GSM (info->modem);
|
MMGenericGsm *self;
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
MMGenericGsmPrivate *priv;
|
||||||
guint id;
|
guint id;
|
||||||
MMModemGsmNetworkRegStatus status;
|
MMModemGsmNetworkRegStatus status;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
self = MM_GENERIC_GSM (info->modem);
|
||||||
|
priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
||||||
|
|
||||||
/* This function should only get called during the connect sequence when
|
/* This function should only get called during the connect sequence when
|
||||||
* polling for registration state, since explicit registration requests
|
* polling for registration state, since explicit registration requests
|
||||||
* from D-Bus clients are filled from the cached registration state.
|
* from D-Bus clients are filled from the cached registration state.
|
||||||
@@ -2806,10 +2869,17 @@ register_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
mm_callback_info_unref (info);
|
mm_callback_info_unref (info);
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
/* If the registration timed out (and thus pending_reg_info will be NULL)
|
/* If the registration timed out (and thus pending_reg_info will be NULL)
|
||||||
* and the modem eventually got around to sending the response for the
|
* and the modem eventually got around to sending the response for the
|
||||||
* registration request then just ignore the response since the callback is
|
* registration request then just ignore the response since the callback is
|
||||||
@@ -2986,6 +3056,11 @@ connect_report_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GError *real_error;
|
GError *real_error;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
/* If the CEER command was successful, copy that error reason into the
|
/* If the CEER command was successful, copy that error reason into the
|
||||||
* callback's error. If not, use the original error.
|
* callback's error. If not, use the original error.
|
||||||
*/
|
*/
|
||||||
@@ -3015,7 +3090,14 @@ connect_done (MMAtSerialPort *port,
|
|||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
@@ -3067,15 +3149,17 @@ disconnect_done (MMModem *modem,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMModemState prev_state;
|
MMModemState prev_state;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (info->error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
if (info->modem && modem) {
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
/* Reset old state since the operation failed */
|
/* Reset old state since the operation failed */
|
||||||
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_GSM_PREV_STATE_TAG));
|
prev_state = GPOINTER_TO_UINT (mm_callback_info_get_data (info, MM_GENERIC_GSM_PREV_STATE_TAG));
|
||||||
mm_modem_set_state (MM_MODEM (info->modem),
|
mm_modem_set_state (MM_MODEM (info->modem),
|
||||||
prev_state,
|
prev_state,
|
||||||
MM_MODEM_STATE_REASON_NONE);
|
MM_MODEM_STATE_REASON_NONE);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
MMGenericGsm *self = MM_GENERIC_GSM (modem);
|
MMGenericGsm *self = MM_GENERIC_GSM (modem);
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
||||||
@@ -3094,7 +3178,14 @@ disconnect_all_done (MMAtSerialPort *port,
|
|||||||
GError *error,
|
GError *error,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
mm_callback_info_schedule ((MMCallbackInfo *) user_data);
|
MMCallbackInfo *info = (MMCallbackInfo *)user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
mm_callback_info_schedule (info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3126,17 +3217,21 @@ disconnect_flash_done (MMSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMGenericGsmPrivate *priv;
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
/* Ignore "NO CARRIER" response when modem disconnects and any flash
|
/* Ignore "NO CARRIER" response when modem disconnects and any flash
|
||||||
* failures we might encounter. Other errors are hard errors.
|
* failures we might encounter. Other errors are hard errors.
|
||||||
*/
|
*/
|
||||||
if ( !g_error_matches (info->error, MM_MODEM_CONNECT_ERROR, MM_MODEM_CONNECT_ERROR_NO_CARRIER)
|
if ( !g_error_matches (error, MM_MODEM_CONNECT_ERROR, MM_MODEM_CONNECT_ERROR_NO_CARRIER)
|
||||||
&& !g_error_matches (info->error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_FLASH_FAILED)) {
|
&& !g_error_matches (error, MM_SERIAL_ERROR, MM_SERIAL_ERROR_FLASH_FAILED)) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_clear_error (&info->error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
@@ -3163,11 +3258,10 @@ disconnect_secondary_cgact_done (MMAtSerialPort *port,
|
|||||||
MMGenericGsm *self;
|
MMGenericGsm *self;
|
||||||
MMGenericGsmPrivate *priv;
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
if (!info->modem) {
|
/* If the modem has already been removed, return without
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
* scheduling callback */
|
||||||
mm_callback_info_schedule (info);
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
self = MM_GENERIC_GSM (info->modem);
|
self = MM_GENERIC_GSM (info->modem);
|
||||||
priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
priv = MM_GENERIC_GSM_GET_PRIVATE (self);
|
||||||
@@ -3257,6 +3351,11 @@ scan_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GPtrArray *results;
|
GPtrArray *results;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -3296,8 +3395,14 @@ set_apn_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
MMGenericGsmPrivate *priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
priv->cid = GPOINTER_TO_INT (mm_callback_info_get_data (info, APN_CID_TAG));
|
priv->cid = GPOINTER_TO_INT (mm_callback_info_get_data (info, APN_CID_TAG));
|
||||||
@@ -3315,6 +3420,11 @@ cid_range_read (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
guint32 cid = 0;
|
guint32 cid = 0;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else if (g_str_has_prefix (response->str, "+CGDCONT:")) {
|
else if (g_str_has_prefix (response->str, "+CGDCONT:")) {
|
||||||
@@ -3381,10 +3491,14 @@ existing_apns_read (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
gboolean found = FALSE;
|
gboolean found = FALSE;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
goto done;
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
else if (g_str_has_prefix (response->str, "+CGDCONT:")) {
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
} else if (g_str_has_prefix (response->str, "+CGDCONT:")) {
|
||||||
GRegex *r;
|
GRegex *r;
|
||||||
GMatchInfo *match_info;
|
GMatchInfo *match_info;
|
||||||
|
|
||||||
@@ -3435,7 +3549,6 @@ existing_apns_read (MMAtSerialPort *port,
|
|||||||
MM_MODEM_ERROR_GENERAL,
|
MM_MODEM_ERROR_GENERAL,
|
||||||
"Could not parse the response");
|
"Could not parse the response");
|
||||||
|
|
||||||
done:
|
|
||||||
if (found || info->error)
|
if (found || info->error)
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
else {
|
else {
|
||||||
@@ -3542,8 +3655,14 @@ get_cind_signal_done (MMAtSerialPort *port,
|
|||||||
GByteArray *indicators;
|
GByteArray *indicators;
|
||||||
guint quality;
|
guint quality;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (!info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
priv = MM_GENERIC_GSM_GET_PRIVATE (info->modem);
|
||||||
|
|
||||||
indicators = mm_parse_cind_query_response (response->str, &info->error);
|
indicators = mm_parse_cind_query_response (response->str, &info->error);
|
||||||
@@ -3571,9 +3690,15 @@ get_csq_done (MMAtSerialPort *port,
|
|||||||
char *reply = response->str;
|
char *reply = response->str;
|
||||||
gboolean parsed = FALSE;
|
gboolean parsed = FALSE;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error)
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strncmp (reply, "+CSQ: ", 6)) {
|
if (!strncmp (reply, "+CSQ: ", 6)) {
|
||||||
/* Got valid reply */
|
/* Got valid reply */
|
||||||
@@ -3721,8 +3846,13 @@ set_allowed_mode_done (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = user_data;
|
MMCallbackInfo *info = user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (!info->error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
MMModemGsmAllowedMode mode = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "mode"));
|
MMModemGsmAllowedMode mode = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "mode"));
|
||||||
|
|
||||||
mm_generic_gsm_update_allowed_mode (MM_GENERIC_GSM (info->modem), mode);
|
mm_generic_gsm_update_allowed_mode (MM_GENERIC_GSM (info->modem), mode);
|
||||||
@@ -3777,8 +3907,13 @@ get_charsets_done (MMAtSerialPort *port,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
MMGenericGsmPrivate *priv;
|
MMGenericGsmPrivate *priv;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3836,8 +3971,13 @@ set_get_charset_done (MMAtSerialPort *port,
|
|||||||
MMModemCharset tried_charset;
|
MMModemCharset tried_charset;
|
||||||
const char *p;
|
const char *p;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3873,13 +4013,18 @@ set_charset_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (info->modem, error);
|
/* If the modem has already been removed, return without
|
||||||
if (info->error) {
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
gboolean tried_no_quotes = !!mm_callback_info_get_data (info, TRIED_NO_QUOTES_TAG);
|
gboolean tried_no_quotes = !!mm_callback_info_get_data (info, TRIED_NO_QUOTES_TAG);
|
||||||
MMModemCharset charset = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "charset"));
|
MMModemCharset charset = GPOINTER_TO_UINT (mm_callback_info_get_data (info, "charset"));
|
||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
if (!info->modem || tried_no_quotes) {
|
if (tried_no_quotes) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3992,6 +4137,11 @@ sms_send_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -4253,6 +4403,11 @@ sms_get_done (MMAtSerialPort *port,
|
|||||||
int rv, status, tpdu_len, offset;
|
int rv, status, tpdu_len, offset;
|
||||||
char pdu[SMS_MAX_PDU_LEN + 1];
|
char pdu[SMS_MAX_PDU_LEN + 1];
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
@@ -4327,6 +4482,11 @@ sms_delete_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
@@ -4368,6 +4528,11 @@ sms_list_done (MMAtSerialPort *port,
|
|||||||
int rv, status, tpdu_len, offset;
|
int rv, status, tpdu_len, offset;
|
||||||
char *rstr;
|
char *rstr;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
else {
|
else {
|
||||||
@@ -4506,6 +4671,11 @@ ussd_send_done (MMAtSerialPort *port,
|
|||||||
const char *str, *start = NULL, *end = NULL;
|
const char *str, *start = NULL, *end = NULL;
|
||||||
char *reply = NULL, *converted;
|
char *reply = NULL, *converted;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
goto done;
|
goto done;
|
||||||
@@ -4664,12 +4834,16 @@ ussd_cancel_done (MMAtSerialPort *port,
|
|||||||
{
|
{
|
||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
|
|
||||||
|
/* If the modem has already been removed, return without
|
||||||
|
* scheduling callback */
|
||||||
|
if (mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
info->error = g_error_copy (error);
|
info->error = g_error_copy (error);
|
||||||
|
|
||||||
mm_callback_info_schedule (info);
|
mm_callback_info_schedule (info);
|
||||||
|
|
||||||
if (info->modem)
|
|
||||||
ussd_update_state (MM_GENERIC_GSM (info->modem), MM_MODEM_GSM_USSD_STATE_IDLE);
|
ussd_update_state (MM_GENERIC_GSM (info->modem), MM_MODEM_GSM_USSD_STATE_IDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4828,9 +5002,14 @@ simple_state_machine (MMModem *modem, GError *error, gpointer user_data)
|
|||||||
gboolean home_only = FALSE;
|
gboolean home_only = FALSE;
|
||||||
char *data_device;
|
char *data_device;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed (modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (info->error)
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
info->error = g_error_copy (error);
|
||||||
goto out;
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
|
priv = MM_GENERIC_GSM_GET_PRIVATE (modem);
|
||||||
|
|
||||||
@@ -5047,8 +5226,13 @@ simple_status_got_reg_info (MMModemGsmNetwork *modem,
|
|||||||
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
|
||||||
GHashTable *properties;
|
GHashTable *properties;
|
||||||
|
|
||||||
info->error = mm_modem_check_removed ((MMModem *) modem, error);
|
/* Do nothing if modem removed */
|
||||||
if (!info->error) {
|
if (!modem || mm_callback_info_check_modem_removed (info))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (error)
|
||||||
|
info->error = g_error_copy (error);
|
||||||
|
else {
|
||||||
properties = (GHashTable *) mm_callback_info_get_data (info, SS_HASH_TAG);
|
properties = (GHashTable *) mm_callback_info_get_data (info, SS_HASH_TAG);
|
||||||
|
|
||||||
g_hash_table_insert (properties, "registration_status", simple_uint_value (status));
|
g_hash_table_insert (properties, "registration_status", simple_uint_value (status));
|
||||||
|
@@ -500,6 +500,8 @@ func_name (MMAtSerialPort *port, \
|
|||||||
GError *error, \
|
GError *error, \
|
||||||
gpointer user_data) \
|
gpointer user_data) \
|
||||||
{ \
|
{ \
|
||||||
|
if (mm_callback_info_check_modem_removed ((MMCallbackInfo *) user_data)) \
|
||||||
|
return; \
|
||||||
info_item_done ((MMCallbackInfo *) user_data, response, error, tag, tag2, desc ); \
|
info_item_done ((MMCallbackInfo *) user_data, response, error, tag, tag2, desc ); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,25 +33,6 @@ static void impl_modem_factory_reset (MMModem *modem, const char *code, DBusGMet
|
|||||||
|
|
||||||
#include "mm-modem-glue.h"
|
#include "mm-modem-glue.h"
|
||||||
|
|
||||||
/* Should be used from callbacks to check whether the modem was removed after
|
|
||||||
* the callback's operation was started, but before the callback itself was
|
|
||||||
* called, in which case the MMModem passed to the callback is NULL.
|
|
||||||
*/
|
|
||||||
GError *
|
|
||||||
mm_modem_check_removed (MMModem *self, const GError *error)
|
|
||||||
{
|
|
||||||
if (!self) {
|
|
||||||
/* If the modem was NULL, the error *should* have been
|
|
||||||
* MM_MODEM_ERROR_REMOVED. If it wasn't, make it that.
|
|
||||||
*/
|
|
||||||
return g_error_new_literal (MM_MODEM_ERROR,
|
|
||||||
MM_MODEM_ERROR_REMOVED,
|
|
||||||
"The modem was removed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
return error ? g_error_copy (error) : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
async_op_not_supported (MMModem *self,
|
async_op_not_supported (MMModem *self,
|
||||||
MMModemFn callback,
|
MMModemFn callback,
|
||||||
|
@@ -282,8 +282,6 @@ void mm_modem_set_state (MMModem *self,
|
|||||||
MMModemState new_state,
|
MMModemState new_state,
|
||||||
MMModemStateReason reason);
|
MMModemStateReason reason);
|
||||||
|
|
||||||
GError *mm_modem_check_removed (MMModem *self, const GError *error);
|
|
||||||
|
|
||||||
/* Request authorization to perform an action. Used by D-Bus method
|
/* Request authorization to perform an action. Used by D-Bus method
|
||||||
* handlers to ensure that the incoming request is authorized to perform
|
* handlers to ensure that the incoming request is authorized to perform
|
||||||
* the action it's requesting.
|
* the action it's requesting.
|
||||||
|
Reference in New Issue
Block a user