[PATCH v2] libmbim-glib: mbim-device: Print parsed packet even for unmatched transaction

Dan Williams dcbw at redhat.com
Wed Jun 18 07:45:13 PDT 2014


On Wed, 2014-06-18 at 07:30 -0700, Prathmesh Prabhu Chromium wrote:
> Hi Aleksander/Dan,
> 
> Any comments? This has been useful to debug some mismatched transactions
> issues locally.

Patch looks fine to me.  I can't push though because I'm lazy and
haven't requested permissions for libmbim.  Which I should really do...

Dan

> Thanks,
> Prathmesh
> 
> 
> On Mon, Jun 16, 2014 at 2:44 PM, <pprabhu at chromium.org> wrote:
> 
> > From: Prathmesh Prabhu <pprabhu at chromium.org>
> >
> > diff --git a/src/libmbim-glib/mbim-device.c
> > b/src/libmbim-glib/mbim-device.c
> > index 6f965e9..9464042 100644
> > --- a/src/libmbim-glib/mbim-device.c
> > +++ b/src/libmbim-glib/mbim-device.c
> > @@ -417,12 +417,13 @@ static void
> >  process_message (MbimDevice  *self,
> >                   const MbimMessage *message)
> >  {
> > +    gboolean is_partial_fragment;
> > +
> > +    is_partial_fragment = (_mbim_message_is_fragment (message) &&
> > +                           _mbim_message_fragment_get_total (message) >
> > 1);
> > +
> >      if (mbim_utils_get_traces_enabled ()) {
> >          gchar *printable;
> > -        gboolean is_partial_fragment;
> > -
> > -        is_partial_fragment = (_mbim_message_is_fragment (message) &&
> > -                               _mbim_message_fragment_get_total (message)
> > > 1);
> >
> >          printable = __mbim_utils_str_hex (((GByteArray *)message)->data,
> >                                            ((GByteArray *)message)->len,
> > @@ -468,8 +469,18 @@ process_message (MbimDevice  *self,
> >              /* Grab transaction */
> >              tr = device_match_transaction (self, TRANSACTION_TYPE_HOST,
> > message);
> >              if (!tr) {
> > +                gchar *printable;
> > +
> >                  g_debug ("[%s] No transaction matched in received
> > message",
> >                           self->priv->path_display);
> > +                /* Attempt to print a user friendly dump of the packet
> > anyway */
> > +                printable = mbim_message_get_printable (message, ">>>>>>
> > ", is_partial_fragment);
> > +                if (printable) {
> > +                    g_debug ("[%s] Received unexpected message
> > (translated)...\n%s",
> > +                             self->priv->path_display,
> > +                             printable);
> > +                    g_free (printable);
> > +                }
> >                  return;
> >              }
> >
> > --
> > 2.0.0.526.g5318336
> >
> >
> _______________________________________________
> ModemManager-devel mailing list
> ModemManager-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/modemmanager-devel




More information about the ModemManager-devel mailing list