test-hog: Add monitor support
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 21 Dec 2021 19:32:51 +0000 (11:32 -0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:38 +0000 (19:08 +0530)
This adds monitor support so data can properly be decoded by the likes
of btmon:

= test-hog: /TP/HGRF/RH/BV-01-I - init
= test-hog: /TP/HGRF/RH/BV-01-I - setup
= test-hog: /TP/HGRF/RH/BV-01-I - setup complete
= test-hog: /TP/HGRF/RH/BV-01-I - run
> test-hog: User Data RX
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)

Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
unit/test-hog.c

index a377c92..e1e9331 100755 (executable)
@@ -78,13 +78,6 @@ struct context {
                tester_add(name, &data, NULL, function, NULL);     \
        } while (0)
 
-static void test_debug(const char *str, void *user_data)
-{
-       const char *prefix = user_data;
-
-       tester_debug("%s%s", prefix, str);
-}
-
 static gboolean context_quit(gpointer user_data)
 {
        struct context *context = user_data;
@@ -116,7 +109,7 @@ static gboolean send_pdu(gpointer user_data)
 
        len = write(context->fd, pdu->data, pdu->size);
 
-       util_hexdump('<', pdu->data, len, test_debug, "hog: ");
+       tester_monitor('<', 0x0004, 0x0000, pdu->data, len);
 
        g_assert_cmpint(len, ==, pdu->size);
 
@@ -155,7 +148,7 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
 
        g_assert(len > 0);
 
-       util_hexdump('>', buf, len, test_debug, "hog: ");
+       tester_monitor('>', 0x0004, 0x0000, buf, len);
 
        g_assert_cmpint(len, ==, pdu->size);