This patch adds sending messages larger than just hal_hdr, and fixes response verification which worked only for empty messages but was failing when sending something more than just header. --- android/test-ipc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/android/test-ipc.c b/android/test-ipc.c index cb6f518..a2d3085 100644 --- a/android/test-ipc.c +++ b/android/test-ipc.c @@ -44,7 +44,7 @@ struct test_data { uint32_t expected_signal; - const struct hal_hdr *cmd; + const void *cmd; uint16_t cmd_size; uint8_t service; const struct ipc_handler *handlers; @@ -79,9 +79,16 @@ static gboolean cmd_watch(GIOChannel *io, GIOCondition cond, { struct context *context = user_data; const struct test_data *test_data = context->data; + const struct hal_hdr *sent_msg = test_data->cmd; uint8_t buf[128]; int sk; + struct hal_hdr success_resp = { + .service_id = sent_msg->service_id, + .opcode = sent_msg->opcode, + .len = 0, + }; + g_assert(test_data->expected_signal == 0); if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL)) { @@ -91,8 +98,8 @@ static gboolean cmd_watch(GIOChannel *io, GIOCondition cond, sk = g_io_channel_unix_get_fd(io); - g_assert(read(sk, buf, sizeof(buf)) == test_data->cmd_size); - g_assert(!memcmp(test_data->cmd, buf, test_data->cmd_size)); + g_assert(read(sk, buf, sizeof(buf)) == sizeof(struct hal_hdr)); + g_assert(!memcmp(&success_resp, buf, sizeof(struct hal_hdr))); context_quit(context); -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html