[PATCH v2] libmbim-glib: print parsed packet even for unmatched transaction
Aleksander Morgado
aleksander at aleksander.es
Thu Jun 19 09:07:47 PDT 2014
On 19/06/14 17:59, Ben Chan wrote:
> From: Prathmesh Prabhu <pprabhu at chromium.org>
>
> ---
> src/libmbim-glib/mbim-device.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
Pushed, thanks.
> diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
> index 4ac6464..da2d507 100644
> --- a/src/libmbim-glib/mbim-device.c
> +++ b/src/libmbim-glib/mbim-device.c
> @@ -418,12 +418,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,
> @@ -478,8 +479,18 @@ process_message (MbimDevice *self,
> (MBIM_MESSAGE_GET_MESSAGE_TYPE (message) - 0x80000000),
> mbim_message_get_transaction_id (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;
> }
>
>
--
Aleksander
https://aleksander.es
More information about the libmbim-devel
mailing list