[PATCH] bearer-mbim: Implement report_connection_status() to set the port as disconnected
Greg Suarez
gpsuarez2512 at gmail.com
Tue Oct 28 09:28:12 PDT 2014
Sure, it takes a few hours for the connection to drop though, so it might
take a while.
Greg
On Tue, Oct 28, 2014 at 8:50 AM, Ben Chan <benchan at chromium.org> wrote:
> Greg,
>
> The patch looks correct. Are you able to reproduce the issue and capture
> the MM log?
>
> Thanks,
> Ben
>
> On Thu, Oct 23, 2014 at 1:15 PM, Greg Suarez <gpsuarez2512 at gmail.com>
> wrote:
>
>> When the MBIM modem unexpectedly loses connection the port state never
>> gets set as disconnected thus when trying to reestablish a new
>> connection the bearer cannot find a port in the disconnected state.
>>
>> Signed-off-by: Greg Suarez <gpsuarez2512 at gmail.com>
>> ---
>> src/mm-bearer-mbim.c | 27 +++++++++++++++++++++++++--
>> 1 file changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
>> index 358b261..c554c52 100644
>> --- a/src/mm-bearer-mbim.c
>> +++ b/src/mm-bearer-mbim.c
>> @@ -950,6 +950,15 @@ disconnect_finish (MMBaseBearer *self,
>> return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT
>> (res), error);
>> }
>>
>> +static void
>> +reset_bearer_connection (MMBearerMbim *self)
>> +{
>> + if (self->priv->data) {
>> + mm_port_set_connected (self->priv->data, FALSE);
>> + g_clear_object (&self->priv->data);
>> + }
>> +}
>> +
>> static void disconnect_context_step (DisconnectContext *ctx);
>>
>> static void
>> @@ -1064,8 +1073,7 @@ disconnect_context_step (DisconnectContext *ctx)
>>
>> case DISCONNECT_STEP_LAST:
>> /* Port is disconnected; update the state */
>> - mm_port_set_connected (ctx->self->priv->data, FALSE);
>> - g_clear_object (&ctx->self->priv->data);
>> + reset_bearer_connection (ctx->self);
>>
>> g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
>> disconnect_context_complete_and_free (ctx);
>> @@ -1126,6 +1134,20 @@ mm_bearer_mbim_get_session_id (MMBearerMbim *self)
>>
>>
>> /*****************************************************************************/
>>
>> +static void
>> +report_connection_status (MMBaseBearer *self,
>> + MMBearerConnectionStatus status)
>> +{
>> + if (status == MM_BEARER_CONNECTION_STATUS_DISCONNECTED)
>> + /* Cleanup all connection related data */
>> + reset_bearer_connection (MM_BEARER_MBIM (self));
>> +
>> + /* Chain up parent's report_connection_status() */
>> + MM_BASE_BEARER_CLASS
>> (mm_bearer_mbim_parent_class)->report_connection_status (self, status);
>> +}
>> +
>>
>> +/*****************************************************************************/
>> +
>> MMBaseBearer *
>> mm_bearer_mbim_new (MMBroadbandModemMbim *modem,
>> MMBearerProperties *config,
>> @@ -1221,6 +1243,7 @@ mm_bearer_mbim_class_init (MMBearerMbimClass *klass)
>> base_bearer_class->connect_finish = connect_finish;
>> base_bearer_class->disconnect = disconnect;
>> base_bearer_class->disconnect_finish = disconnect_finish;
>> + base_bearer_class->report_connection_status =
>> report_connection_status;
>>
>> properties[PROP_SESSION_ID] =
>> g_param_spec_uint (MM_BEARER_MBIM_SESSION_ID,
>> --
>> 1.9.3
>>
>> _______________________________________________
>> ModemManager-devel mailing list
>> ModemManager-devel at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/modemmanager-devel/attachments/20141028/3776823a/attachment-0001.html>
More information about the ModemManager-devel
mailing list