huawei: retry connect/disconnect attempt upon ^NDISSTATQRY? failures
The Huawei MU736 modem sometimes responds to the ^NDISSTATQRY? query with a '+CME ERROR: 100' error. This patch works around the issue by ignoring a few of these error responses in a connect / disconnect attempt. The overall timeout for the connect/disconnect operation is not affected by this change.
This commit is contained in:

committed by
Aleksander Morgado

parent
c014bce554
commit
57c657bd06
@@ -57,6 +57,7 @@ typedef struct {
|
|||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
Connect3gppContextStep step;
|
Connect3gppContextStep step;
|
||||||
guint check_count;
|
guint check_count;
|
||||||
|
guint failed_ndisstatqry_count;
|
||||||
} Connect3gppContext;
|
} Connect3gppContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -130,16 +131,10 @@ connect_ndisstatqry_check_ready (MMBaseModem *modem,
|
|||||||
&ipv6_available,
|
&ipv6_available,
|
||||||
&ipv6_connected,
|
&ipv6_connected,
|
||||||
&error)) {
|
&error)) {
|
||||||
mm_dbg ("Modem doesn't properly support ^NDISSTATQRY command: %s", error->message);
|
ctx->failed_ndisstatqry_count++;
|
||||||
|
mm_dbg ("Unexpected response to ^NDISSTATQRY command: %s (Attempts so far: %u)",
|
||||||
|
error->message, ctx->failed_ndisstatqry_count);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
ctx->self->priv->connect_pending = NULL;
|
|
||||||
g_simple_async_result_set_error (ctx->result,
|
|
||||||
MM_MOBILE_EQUIPMENT_ERROR,
|
|
||||||
MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,
|
|
||||||
"Connection attempt not supported");
|
|
||||||
connect_3gpp_context_complete_and_free (ctx);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connected in IPv4? */
|
/* Connected in IPv4? */
|
||||||
@@ -316,6 +311,18 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Give up if too many unexpected responses to NIDSSTATQRY are encountered. */
|
||||||
|
if (ctx->failed_ndisstatqry_count > 10) {
|
||||||
|
/* Clear context */
|
||||||
|
ctx->self->priv->connect_pending = NULL;
|
||||||
|
g_simple_async_result_set_error (ctx->result,
|
||||||
|
MM_MOBILE_EQUIPMENT_ERROR,
|
||||||
|
MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,
|
||||||
|
"Connection attempt not supported.");
|
||||||
|
connect_3gpp_context_complete_and_free (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if connected */
|
/* Check if connected */
|
||||||
ctx->check_count++;
|
ctx->check_count++;
|
||||||
mm_base_modem_at_command_full (ctx->modem,
|
mm_base_modem_at_command_full (ctx->modem,
|
||||||
@@ -413,6 +420,7 @@ typedef struct {
|
|||||||
GSimpleAsyncResult *result;
|
GSimpleAsyncResult *result;
|
||||||
Disconnect3gppContextStep step;
|
Disconnect3gppContextStep step;
|
||||||
guint check_count;
|
guint check_count;
|
||||||
|
guint failed_ndisstatqry_count;
|
||||||
} Disconnect3gppContext;
|
} Disconnect3gppContext;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -480,16 +488,10 @@ disconnect_ndisstatqry_check_ready (MMBaseModem *modem,
|
|||||||
&ipv6_available,
|
&ipv6_available,
|
||||||
&ipv6_connected,
|
&ipv6_connected,
|
||||||
&error)) {
|
&error)) {
|
||||||
mm_dbg ("Modem doesn't properly support ^NDISSTATQRY command: %s", error->message);
|
ctx->failed_ndisstatqry_count++;
|
||||||
|
mm_dbg ("Unexpected response to ^NDISSTATQRY command: %s (Attempts so far: %u)",
|
||||||
|
error->message, ctx->failed_ndisstatqry_count);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
|
|
||||||
ctx->self->priv->disconnect_pending = NULL;
|
|
||||||
g_simple_async_result_set_error (ctx->result,
|
|
||||||
MM_MOBILE_EQUIPMENT_ERROR,
|
|
||||||
MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,
|
|
||||||
"Disconnection attempt not supported");
|
|
||||||
disconnect_3gpp_context_complete_and_free (ctx);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disconnected IPv4? */
|
/* Disconnected IPv4? */
|
||||||
@@ -569,6 +571,18 @@ disconnect_3gpp_context_step (Disconnect3gppContext *ctx)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Give up if too many unexpected responses to NIDSSTATQRY are encountered. */
|
||||||
|
if (ctx->failed_ndisstatqry_count > 10) {
|
||||||
|
/* Clear context */
|
||||||
|
ctx->self->priv->disconnect_pending = NULL;
|
||||||
|
g_simple_async_result_set_error (ctx->result,
|
||||||
|
MM_MOBILE_EQUIPMENT_ERROR,
|
||||||
|
MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,
|
||||||
|
"Disconnection attempt not supported.");
|
||||||
|
disconnect_3gpp_context_complete_and_free (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if disconnected */
|
/* Check if disconnected */
|
||||||
ctx->check_count++;
|
ctx->check_count++;
|
||||||
mm_base_modem_at_command_full (ctx->modem,
|
mm_base_modem_at_command_full (ctx->modem,
|
||||||
|
Reference in New Issue
Block a user