unit: print mbim messages for easier debugging

This commit is contained in:
Denis Kenzior 2017-10-03 11:36:17 -05:00
parent dc19edbeb4
commit 95ac1efb13
1 changed files with 12 additions and 0 deletions

View File

@ -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;