aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Schrock <steve.schrock@getcruise.com>2024-02-20 23:25:27 +0000
committerDenis Kenzior <denkenz@gmail.com>2024-02-21 09:46:47 -0600
commit46a2fde548a60de946650bcea1e2f0dc1184dbaa (patch)
treeb00ced213728a54f24967abff0d1f3982ecedaca
parent8b64c46779d949f2bba08e5ccc76e4c256191da1 (diff)
downloadofono-46a2fde548a60de946650bcea1e2f0dc1184dbaa.tar.gz
qmimodem: Use l_util_hexdump
-rw-r--r--drivers/qmimodem/qmi.c51
1 files changed, 4 insertions, 47 deletions
diff --git a/drivers/qmimodem/qmi.c b/drivers/qmimodem/qmi.c
index b51df0e79..b8f019cc0 100644
--- a/drivers/qmimodem/qmi.c
+++ b/drivers/qmimodem/qmi.c
@@ -271,49 +271,6 @@ static gboolean __service_compare_shared(gpointer key, gpointer value,
return FALSE;
}
-static void __hexdump(const char dir, const unsigned char *buf, size_t len,
- qmi_debug_func_t function, void *user_data)
-{
- static const char hexdigits[] = "0123456789abcdef";
- char str[68];
- size_t i;
-
- if (!function || !len)
- return;
-
- str[0] = dir;
-
- for (i = 0; i < len; i++) {
- str[((i % 16) * 3) + 1] = ' ';
- str[((i % 16) * 3) + 2] = hexdigits[buf[i] >> 4];
- str[((i % 16) * 3) + 3] = hexdigits[buf[i] & 0xf];
- str[(i % 16) + 51] = isprint(buf[i]) ? buf[i] : '.';
-
- if ((i + 1) % 16 == 0) {
- str[49] = ' ';
- str[50] = ' ';
- str[67] = '\0';
- function(str, user_data);
- str[0] = ' ';
- }
- }
-
- if (i % 16 > 0) {
- size_t j;
-
- for (j = (i % 16); j < 16; j++) {
- str[(j * 3) + 1] = ' ';
- str[(j * 3) + 2] = ' ';
- str[(j * 3) + 3] = ' ';
- str[j + 51] = ' ';
- }
- str[49] = ' ';
- str[50] = ' ';
- str[67] = '\0';
- function(str, user_data);
- }
-}
-
static const char *__service_type_to_string(uint8_t type)
{
switch (type) {
@@ -665,8 +622,8 @@ static gboolean can_write_data(GIOChannel *channel, GIOCondition cond,
if (bytes_written < 0)
return FALSE;
- __hexdump('>', req->buf, bytes_written,
- device->debug_func, device->debug_data);
+ l_util_hexdump(false, req->buf, bytes_written,
+ device->debug_func, device->debug_data);
__debug_msg(' ', req->buf, bytes_written,
device->debug_func, device->debug_data);
@@ -883,8 +840,8 @@ static gboolean received_data(GIOChannel *channel, GIOCondition cond,
if (bytes_read < 0)
return TRUE;
- __hexdump('<', buf, bytes_read,
- device->debug_func, device->debug_data);
+ l_util_hexdump(true, buf, bytes_read,
+ device->debug_func, device->debug_data);
offset = 0;