[PATCH] bearer-mbim: use the context IP type MM asked to be activated instead of modem response

Aleksander Morgado aleksander at aleksander.es
Fri Jun 17 17:16:19 UTC 2016


On Fri, Jun 17, 2016 at 5:46 PM, Dan Williams <dcbw at redhat.com> wrote:
> MM never passes MBIM_CONTEXT_IP_TYPE_DEFAULT which would require paying
> attention to the ip_type in the reply to figure out what type the modem
> activated.  Instead, MM always specifies the ip_type it wants to activate,
> and some modems (K5160) return a different type in the response.  The modem
> is required to activate the type MM asks for or return an error, so if
> the activation was successful we can safely assume the modem activated
> the ip_type we want, and we can ignore the ip_type in the response.

+1

> ---
>  src/mm-bearer-mbim.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
> index 8c69fb3..be58950 100644
> --- a/src/mm-bearer-mbim.c
> +++ b/src/mm-bearer-mbim.c
> @@ -581,7 +581,6 @@ connect_set_ready (MbimDevice *device,
>      MbimMessage *response;
>      guint32 session_id;
>      MbimActivationState activation_state;
> -    MbimContextIpType ip_type;
>      guint32 nw_error;
>
>      response = mbim_device_command_finish (device, res, &error);
> @@ -595,7 +594,7 @@ connect_set_ready (MbimDevice *device,
>                  &session_id,
>                  &activation_state,
>                  NULL, /* voice_call_state */
> -                &ip_type,
> +                NULL, /* ip_type */
>                  NULL, /* context_type */
>                  &nw_error,
>                  &inner_error)) {
> @@ -604,11 +603,15 @@ connect_set_ready (MbimDevice *device,
>                      g_error_free (error);
>                  error = mm_mobile_equipment_error_from_mbim_nw_error (nw_error);
>              } else {
> -                ctx->ip_type = ip_type;
> +                /* Report the ip_type we originally requested, since the ip_type
> +                 * from the response is only relevant if the requested used
> +                 * MBIM_CONTEXT_IP_TYPE_DEFAULT, which MM never does.  Some
> +                 * devices (K5160) report the wrong type in the response.
> +                 */
>                  mm_dbg ("Session ID '%u': %s (IP type: %s)",
>                          session_id,
>                          mbim_activation_state_get_string (activation_state),
> -                        mbim_context_ip_type_get_string (ip_type));
> +                        mbim_context_ip_type_get_string (ctx->ip_type));
>              }
>          } else {
>              /* Prefer the error from the result to the parsing error */
> --
> 2.5.5
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/modemmanager-devel



-- 
Aleksander
https://aleksander.es


More information about the ModemManager-devel mailing list