broadband-modem-qmi: check MDN set after manual activation
This commit is contained in:
@@ -5115,6 +5115,8 @@ modem_cdma_load_activation_state (MMIfaceModemCdma *self,
|
||||
/*****************************************************************************/
|
||||
/* Manual and OTA Activation (CDMA interface) */
|
||||
|
||||
#define MAX_MDN_CHECK_RETRIES 10
|
||||
|
||||
typedef enum {
|
||||
CDMA_ACTIVATION_STEP_FIRST,
|
||||
CDMA_ACTIVATION_STEP_ENABLE_INDICATIONS,
|
||||
@@ -5137,6 +5139,7 @@ typedef struct {
|
||||
guint segment_i;
|
||||
guint n_segments;
|
||||
GArray **segments;
|
||||
guint n_mdn_check_retries;
|
||||
} CdmaActivationContext;
|
||||
|
||||
static void
|
||||
@@ -5213,6 +5216,61 @@ activation_power_cycle_ready (MMBroadbandModemQmi *self,
|
||||
cdma_activation_context_step (ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
retry_msisdn_check_cb (CdmaActivationContext *ctx)
|
||||
{
|
||||
cdma_activation_context_step (ctx);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
activate_manual_get_msisdn_ready (QmiClientDms *client,
|
||||
GAsyncResult *res,
|
||||
CdmaActivationContext *ctx)
|
||||
{
|
||||
QmiMessageDmsGetMsisdnOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
const gchar *current_mdn = NULL;
|
||||
const gchar *expected_mdn = NULL;
|
||||
|
||||
qmi_message_dms_activate_manual_input_get_info (ctx->input_manual,
|
||||
NULL, /* spc */
|
||||
NULL, /* sid */
|
||||
&expected_mdn,
|
||||
NULL, /* min */
|
||||
NULL);
|
||||
|
||||
output = qmi_client_dms_get_msisdn_finish (client, res, &error);
|
||||
if (output &&
|
||||
qmi_message_dms_get_msisdn_output_get_result (output, NULL) &&
|
||||
qmi_message_dms_get_msisdn_output_get_msisdn (output, ¤t_mdn, NULL) &&
|
||||
g_str_equal (current_mdn, expected_mdn)) {
|
||||
mm_dbg ("MDN successfully updated to '%s'", expected_mdn);
|
||||
qmi_message_dms_get_msisdn_output_unref (output);
|
||||
/* And go on to next step */
|
||||
ctx->step++;
|
||||
cdma_activation_context_step (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (output)
|
||||
qmi_message_dms_get_msisdn_output_unref (output);
|
||||
|
||||
if (ctx->n_mdn_check_retries < MAX_MDN_CHECK_RETRIES) {
|
||||
/* Retry after some time */
|
||||
mm_dbg ("MDN not yet updated, retrying...");
|
||||
g_timeout_add (1, (GSourceFunc) retry_msisdn_check_cb, ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Well, all retries consumed already, return error */
|
||||
g_simple_async_result_set_error (ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"MDN was not correctly set during manual activation");
|
||||
cdma_activation_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
activation_event_report_indication_cb (QmiClientDms *client,
|
||||
QmiIndicationDmsEventReportOutput *output,
|
||||
@@ -5399,7 +5457,9 @@ cdma_activation_context_step (CdmaActivationContext *ctx)
|
||||
ctx->step++;
|
||||
/* Fall down to next step */
|
||||
|
||||
case CDMA_ACTIVATION_STEP_ENABLE_INDICATIONS: {
|
||||
case CDMA_ACTIVATION_STEP_ENABLE_INDICATIONS:
|
||||
/* Indications needed in automatic activation */
|
||||
if (ctx->input_automatic) {
|
||||
QmiMessageDmsSetEventReportInput *input;
|
||||
|
||||
mm_info ("Activation step [1/5]: enabling indications");
|
||||
@@ -5417,6 +5477,12 @@ cdma_activation_context_step (CdmaActivationContext *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Manual activation, no indications needed */
|
||||
g_assert (ctx->input_manual != NULL);
|
||||
mm_info ("Activation step [1/5]: indications not needed in manual activation");
|
||||
ctx->step++;
|
||||
/* Fall down to next step */
|
||||
|
||||
case CDMA_ACTIVATION_STEP_REQUEST_ACTIVATION:
|
||||
/* Automatic activation */
|
||||
if (ctx->input_automatic) {
|
||||
@@ -5432,7 +5498,7 @@ cdma_activation_context_step (CdmaActivationContext *ctx)
|
||||
}
|
||||
|
||||
/* Manual activation */
|
||||
if (ctx->input_manual) {
|
||||
g_assert (ctx->input_manual != NULL);
|
||||
if (!ctx->segments)
|
||||
mm_info ("Activation step [2/5]: requesting manual activation");
|
||||
else {
|
||||
@@ -5453,14 +5519,26 @@ cdma_activation_context_step (CdmaActivationContext *ctx)
|
||||
(GAsyncReadyCallback)activate_manual_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
|
||||
case CDMA_ACTIVATION_STEP_WAIT_UNTIL_FINISHED:
|
||||
/* Automatic activation */
|
||||
if (ctx->input_automatic) {
|
||||
/* State updates via unsolicited messages */
|
||||
mm_info ("Activation step [3/5]: waiting for activation state updates");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Manual activation; needs MSISDN checks */
|
||||
g_assert (ctx->input_manual != NULL);
|
||||
ctx->n_mdn_check_retries++;
|
||||
mm_info ("Activation step [3/5]: checking MDN update (retry %u)", ctx->n_mdn_check_retries);
|
||||
qmi_client_dms_get_msisdn (ctx->client,
|
||||
NULL,
|
||||
5,
|
||||
NULL,
|
||||
(GAsyncReadyCallback)activate_manual_get_msisdn_ready,
|
||||
ctx);
|
||||
return;
|
||||
|
||||
case CDMA_ACTIVATION_STEP_POWER_CYCLE:
|
||||
mm_info ("Activation step [4/5]: power-cycling...");
|
||||
|
Reference in New Issue
Block a user