<div dir="ltr"><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)">Hi,</pre><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)">Please consider the following patch.</pre>
<pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)"><br></pre><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)">Thanks,</pre><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)">
Prathmesh</pre><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)"><br></pre><pre class="" style="font-size:9pt;margin-top:0px;margin-bottom:0px;color:rgb(53,53,53)">This is a workaround for a bug in the modem firmware that causes the NDISSTATQRY<br>
response to be an error response intermittently. With this patch, the connect /<br>disconnect attempt ignores a few of these error responses. Note that the overall<br>time-out for the connect/disconnect is not affected by this change.</pre>
<div><br></div><div><div>diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c</div><div>index 2e1b0b0..75d3566 100644</div><div>--- a/plugins/huawei/mm-broadband-bearer-huawei.c</div>
<div>+++ b/plugins/huawei/mm-broadband-bearer-huawei.c</div><div>@@ -57,6 +57,7 @@ typedef struct {</div><div> GSimpleAsyncResult *result;</div><div> Connect3gppContextStep step;</div><div> guint check_count;</div>
<div>+ guint failed_ndisstatqry_count;</div><div> } Connect3gppContext;</div><div><br></div><div> static void</div><div>@@ -130,20 +131,15 @@ connect_ndisstatqry_check_ready (MMBaseModem *modem,</div><div> &ipv6_available,</div>
<div> &ipv6_connected,</div><div> &error)) {</div><div>- mm_dbg ("Modem doesn't properly support ^NDISSTATQRY command: %s", error->message);</div>
<div>+ ctx->failed_ndisstatqry_count++;</div><div>+ mm_dbg ("Unexpected response to ^NDISSTATQRY command: %s (Attempts so far: %d)",</div><div>+ error->message, ctx->failed_ndisstatqry_count);</div>
<div> g_error_free (error);</div><div>-</div><div>- ctx->self->priv->connect_pending = NULL;</div><div>- g_simple_async_result_set_error (ctx->result,</div><div>- MM_MOBILE_EQUIPMENT_ERROR,</div>
<div>- MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,</div><div>- "Connection attempt not supported");</div><div>- connect_3gpp_context_complete_and_free (ctx);</div>
<div>- return;</div><div>+ response = NULL; /* Set to NULL to skip steps below. */</div><div> }</div><div><br></div><div> /* Connected in IPv4? */</div><div>- if (ipv4_available && ipv4_connected) {</div>
<div>+ if (response && ipv4_available && ipv4_connected) {</div><div> /* Success! */</div><div> ctx->step++;</div><div> connect_3gpp_context_step (ctx);</div><div>@@ -315,6 +311,17 @@ connect_3gpp_context_step (Connect3gppContext *ctx)</div>
<div> connect_3gpp_context_complete_and_free (ctx);</div><div> return;</div><div> }</div><div>+ /* Give up if too many unexpected responses to NIDSSTATQRY are encountered. */</div><div>
+ if (ctx->failed_ndisstatqry_count > 3) {</div><div>+ /* Clear context */</div><div>+ ctx->self->priv->connect_pending = NULL;</div><div>+ g_simple_async_result_set_error (ctx->result,</div>
<div>+ MM_MOBILE_EQUIPMENT_ERROR,</div><div>+ MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,</div><div>+ "Connection attempt not supported.");</div>
<div>+ connect_3gpp_context_complete_and_free (ctx);</div><div>+ return;</div><div>+ }</div><div><br></div><div> /* Check if connected */</div><div> ctx->check_count++;</div>
<div>@@ -413,6 +420,7 @@ typedef struct {</div><div> GSimpleAsyncResult *result;</div><div> Disconnect3gppContextStep step;</div><div> guint check_count;</div><div>+ guint failed_ndisstatqry_count;</div><div>
} Disconnect3gppContext;</div><div><br></div><div> static void</div><div>@@ -480,20 +488,15 @@ disconnect_ndisstatqry_check_ready (MMBaseModem *modem,</div><div> &ipv6_available,</div>
<div> &ipv6_connected,</div><div> &error)) {</div><div>- mm_dbg ("Modem doesn't properly support ^NDISSTATQRY command: %s", error->message);</div>
<div>+ ctx->failed_ndisstatqry_count++;</div><div>+ mm_dbg ("Unexpected response to ^NDISSTATQRY command: %s (Attempts so far: %d)",</div><div>+ error->message, ctx->failed_ndisstatqry_count);</div>
<div> g_error_free (error);</div><div>-</div><div>- ctx->self->priv->disconnect_pending = NULL;</div><div>- g_simple_async_result_set_error (ctx->result,</div><div>- MM_MOBILE_EQUIPMENT_ERROR,</div>
<div>- MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,</div><div>- "Disconnection attempt not supported");</div><div>- disconnect_3gpp_context_complete_and_free (ctx);</div>
<div>- return;</div><div>+ response = NULL; /* Set to NULL to skip steps below. */</div><div> }</div><div><br></div><div> /* Disconnected IPv4? */</div><div>- if (ipv4_available && !ipv4_connected) {</div>
<div>+ if (response && ipv4_available && !ipv4_connected) {</div><div> /* Success! */</div><div> ctx->step++;</div><div> disconnect_3gpp_context_step (ctx);</div><div>@@ -568,6 +571,17 @@ disconnect_3gpp_context_step (Disconnect3gppContext *ctx)</div>
<div> disconnect_3gpp_context_complete_and_free (ctx);</div><div> return;</div><div> }</div><div>+ /* Give up if too many unexpected responses to NIDSSTATQRY are encountered. */</div>
<div>+ if (ctx->failed_ndisstatqry_count > 3) {</div><div>+ /* Clear context */</div><div>+ ctx->self->priv->disconnect_pending = NULL;</div><div>+ g_simple_async_result_set_error (ctx->result,</div>
<div>+ MM_MOBILE_EQUIPMENT_ERROR,</div><div>+ MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,</div><div>+ "Disconnection attempt not supported.");</div>
<div>+ disconnect_3gpp_context_complete_and_free (ctx);</div><div>+ return;</div><div>+ }</div><div><br></div><div> /* Check if disconnected */</div><div> ctx->check_count++;</div>
</div>
</div>