From 95ac1efb134db2c3ccf2e610f5ca4b060595fff6 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 3 Oct 2017 11:36:17 -0500 Subject: [PATCH] unit: print mbim messages for easier debugging --- unit/test-mbim.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/unit/test-mbim.c b/unit/test-mbim.c index fb0b53eb..88d54b5f 100644 --- a/unit/test-mbim.c +++ b/unit/test-mbim.c @@ -112,6 +112,13 @@ static const struct message_data message_data_phonebook_read = { .binary_len = sizeof(message_binary_phonebook_read), }; +static void do_debug(const char *str, void *user_data) +{ + const char *prefix = user_data; + + l_info("%s%s", prefix, str); +} + static struct mbim_message *build_message(const struct message_data *msg_data) { static const int frag_size = 64; @@ -149,6 +156,11 @@ static bool check_message(struct mbim_message *message, void *message_binary = _mbim_message_to_bytearray(message, &len); bool r = false; + l_util_hexdump(false, msg_data->binary, msg_data->binary_len, + do_debug, "[MSG] "); + + l_util_hexdump(true, message_binary, len, do_debug, "[MSG] "); + assert(message_binary); if (len != msg_data->binary_len) goto done;