Lots of random fixes:
Rework the MMCallbackInfo callback invocation. Always use g_error_literal() where it makes sense. Replace sleep() calls, with timeouts to not block the whole MM.
This commit is contained in:
@@ -33,6 +33,18 @@ pin_check_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
option_enabled (gpointer data)
|
||||
{
|
||||
MMCallbackInfo *info = (MMCallbackInfo *) data;
|
||||
|
||||
/* Now check the PIN explicitly, option doesn't seem to report
|
||||
that it needs it otherwise */
|
||||
mm_generic_gsm_check_pin (MM_GENERIC_GSM (info->modem), pin_check_done, info);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
parent_enable_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
@@ -43,11 +55,7 @@ parent_enable_done (MMModem *modem, GError *error, gpointer user_data)
|
||||
else if (GPOINTER_TO_INT (mm_callback_info_get_data (info, "option-enable"))) {
|
||||
/* Option returns OK on +CFUN=1 right away but needs some time
|
||||
to finish initialization */
|
||||
sleep (10);
|
||||
|
||||
/* Now check the PIN explicitly, option doesn't seem to report
|
||||
that it needs it otherwise */
|
||||
mm_generic_gsm_check_pin (MM_GENERIC_GSM (modem), pin_check_done, info);
|
||||
g_timeout_add_seconds (10, option_enabled, info);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -110,8 +118,8 @@ get_network_mode_done (MMSerial *serial,
|
||||
}
|
||||
|
||||
if (!error && !parsed)
|
||||
info->error = g_error_new (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||
"%s", "Could not parse network mode results");
|
||||
info->error = g_error_new_literal (MM_MODEM_ERROR, MM_MODEM_ERROR_GENERAL,
|
||||
"Could not parse network mode results");
|
||||
|
||||
mm_callback_info_schedule (info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user