UPSTREAM: libmbim-glib,device: print unexpected message contents only if traces enabled
BUG=b:288071220
TEST=CQ passes
(cherry picked from commit 3b073f18621311de906700e499dfd201298aa83f)
Change-Id: I16de6b4a9507537d9e8e4833c8af9c3c8bb25477
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/libmbim/+/4892862
Reviewed-by: Eric Caruso <ejcaruso@chromium.org>
Tested-by: Aleksander Morgado <aleksandermj@google.com>
Commit-Queue: Aleksander Morgado <aleksandermj@google.com>
diff --git a/src/libmbim-glib/mbim-device.c b/src/libmbim-glib/mbim-device.c
index 401aaa9..89aa921 100644
--- a/src/libmbim-glib/mbim-device.c
+++ b/src/libmbim-glib/mbim-device.c
@@ -978,21 +978,24 @@
(MBIM_MESSAGE_GET_MESSAGE_TYPE (message) - 0x80000000),
mbim_message_get_transaction_id (message));
if (!task) {
- g_autofree gchar *printable = NULL;
-
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_full (message,
- self->priv->ms_mbimex_version_major,
- self->priv->ms_mbimex_version_minor,
- ">>>>>> ",
- is_partial_fragment,
- NULL);
- if (printable)
- g_debug ("[%s] received unexpected message (translated)...\n%s",
- self->priv->path_display,
- printable);
+ if (mbim_utils_get_traces_enabled ()) {
+ g_autofree gchar *printable = NULL;
+
+ printable = mbim_message_get_printable_full (message,
+ self->priv->ms_mbimex_version_major,
+ self->priv->ms_mbimex_version_minor,
+ ">>>>>> ",
+ is_partial_fragment,
+ NULL);
+ if (printable)
+ g_debug ("[%s] received unexpected message (translated)...\n%s",
+ self->priv->path_display,
+ printable);
+ }
/* If we're opening and we get a CLOSE_DONE message without any
* matched transaction, finalize the open request right away to