From patchwork Mon Nov 2 19:12:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875035 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D89AAC2D0A3 for ; Mon, 2 Nov 2020 19:12:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6ED662225E for ; Mon, 2 Nov 2020 19:12:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q3BaXOtS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726456AbgKBTMg (ORCPT ); Mon, 2 Nov 2020 14:12:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726433AbgKBTMf (ORCPT ); Mon, 2 Nov 2020 14:12:35 -0500 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC347C0617A6 for ; Mon, 2 Nov 2020 11:12:35 -0800 (PST) Received: by mail-pg1-x531.google.com with SMTP id z24so11631394pgk.3 for ; Mon, 02 Nov 2020 11:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=UOqgW6gYJUJOpOWSWevnjNEwQyetSI3mUh93Pehd4Ik=; b=Q3BaXOtSsZg7LeEnYM2dPQRmpUH+5STQunUWi7sMjhfcx2TeUTtdMfyNCAErtrFRu4 WYoYPyDmx9ob2VTQR17SdphwQ+uJfikOcA8+kErMXNG1mKSoGktrENENOHa9mhdejtIH hcG2n8Cea02tEY88APsBKTuVxgjyAGPE3kVVhtsKMeycjyLm9cI5QMyF+q9+wHHABD7f S3Qp/DM34Fy3UCvAWQ1RJCEC6d5kUZQeoZ52xzQPEeEC8AAvVm5Tocev66v1Ld1JnjY/ e4KG3ACzUSCD1A+StN/bbntIFpi6eo83pVR9/rT8EqA//jy/u0ozodaEkY2imgRnOXFA oceg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=UOqgW6gYJUJOpOWSWevnjNEwQyetSI3mUh93Pehd4Ik=; b=RbltOI8SUaU6AcBm4QJdedONxh+rg7jYMjNq57xXxujGedEfIQ9viEMcCv3PIx/k5f 31k1/riFko7zz0d74p66Lds1kxmC5L3NmWxUoDtcWewspMHbkuUapNDElAIbpjgpirf8 mKGVKtobEByvKx/yxLtirb0ZQxFAOV5un+0xfNp/VEwOb0d6ZrnpG+FieucXOYDvxE/h NklwgFo4Pf9Ky+9Be3L7EL4qfl/ZzQN5oKrl+weUBCHlYb6Z0OMHz9pUOyn9CQhdCm/I doZe6CIi0fXP6m3iBMxU1jMBP8md83NjWuXxMwXKgKt8GGpRCCupEzuraQcrbXHvCqAl eydQ== X-Gm-Message-State: AOAM533BDXquy1Z4NgSUt/RCAS34xNN8W/OK7vnyvN2pP9do6vzmGqbq uO7twwwoz2KYSA6dOUNsR1IiXB3Jay2AnQ== X-Google-Smtp-Source: ABdhPJz5xeqDea/ZsS1ebfuTFA7h1K9WNQOpf+Ut1QYxjrgcG8McHhuNQLckGg/tf3LGF4EdEYFzuw== X-Received: by 2002:a17:90a:34cd:: with SMTP id m13mr19449866pjf.201.1604344354806; Mon, 02 Nov 2020 11:12:34 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:33 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 01/11] emulator/btdev: Add debug support Date: Mon, 2 Nov 2020 11:12:22 -0800 Message-Id: <20201102191232.1848737-1-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds btdev_set_debug which can be used to debug internals of btdev. --- emulator/btdev.c | 99 +++++++++++++++++++++++++----------------------- emulator/btdev.h | 5 +++ 2 files changed, 57 insertions(+), 47 deletions(-) diff --git a/emulator/btdev.c b/emulator/btdev.c index ca87681a6..c89815b3e 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -144,6 +144,10 @@ struct btdev { uint8_t sync_train_service_data; uint16_t le_ext_adv_type; + + btdev_debug_func_t debug_callback; + btdev_destroy_func_t debug_destroy; + void *debug_data; }; struct inquiry_data { @@ -257,45 +261,6 @@ static inline struct btdev *find_btdev_by_bdaddr_type(const uint8_t *bdaddr, return NULL; } -static void hexdump(const unsigned char *buf, uint16_t len) -{ - static const char hexdigits[] = "0123456789abcdef"; - char str[68]; - uint16_t i; - - if (!len) - return; - - for (i = 0; i < len; i++) { - str[((i % 16) * 3) + 0] = hexdigits[buf[i] >> 4]; - str[((i % 16) * 3) + 1] = hexdigits[buf[i] & 0xf]; - str[((i % 16) * 3) + 2] = ' '; - str[(i % 16) + 49] = isprint(buf[i]) ? buf[i] : '.'; - - if ((i + 1) % 16 == 0) { - str[47] = ' '; - str[48] = ' '; - str[65] = '\0'; - printf("%-12c%s\n", ' ', str); - str[0] = ' '; - } - } - - if (i % 16 > 0) { - uint16_t j; - for (j = (i % 16); j < 16; j++) { - str[(j * 3) + 0] = ' '; - str[(j * 3) + 1] = ' '; - str[(j * 3) + 2] = ' '; - str[j + 49] = ' '; - } - str[47] = ' '; - str[48] = ' '; - str[65] = '\0'; - printf("%-12c%s\n", ' ', str); - } -} - static void get_bdaddr(uint16_t id, uint8_t index, uint8_t *bdaddr) { bdaddr[0] = id & 0xff; @@ -768,6 +733,22 @@ void btdev_destroy(struct btdev *btdev) free(btdev); } +bool btdev_set_debug(struct btdev *btdev, btdev_debug_func_t callback, + void *user_data, btdev_destroy_func_t destroy) +{ + if (!btdev) + return false; + + if (btdev->debug_destroy) + btdev->debug_destroy(btdev->debug_data); + + btdev->debug_callback = callback; + btdev->debug_destroy = destroy; + btdev->debug_data = user_data; + + return true; +} + const uint8_t *btdev_get_bdaddr(struct btdev *btdev) { return btdev->bdaddr; @@ -824,9 +805,20 @@ void btdev_set_send_handler(struct btdev *btdev, btdev_send_func handler, static void send_packet(struct btdev *btdev, const struct iovec *iov, int iovlen) { + int i; + if (!btdev->send_handler) return; + for (i = 0; i < iovlen; i++) { + if (!i) + util_hexdump('<', iov[i].iov_base, iov[i].iov_len, + btdev->debug_callback, btdev->debug_data); + else + util_hexdump(' ', iov[i].iov_base, iov[i].iov_len, + btdev->debug_callback, btdev->debug_data); + } + btdev->send_handler(iov, iovlen, btdev->send_data); } @@ -837,6 +829,9 @@ static void send_event(struct btdev *btdev, uint8_t event, struct iovec iov[3]; uint8_t pkt = BT_H4_EVT_PKT; + util_debug(btdev->debug_callback, btdev->debug_data, + "event 0x%02x", event); + iov[0].iov_base = &pkt; iov[0].iov_len = sizeof(pkt); @@ -863,6 +858,9 @@ static void send_cmd(struct btdev *btdev, uint8_t evt, uint16_t opcode, uint8_t pkt = BT_H4_EVT_PKT; int i; + util_debug(btdev->debug_callback, btdev->debug_data, + "event 0x%02x opcode 0x%04x", evt, opcode); + iov2[0].iov_base = &pkt; iov2[0].iov_len = sizeof(pkt); @@ -921,6 +919,9 @@ static void le_meta_event(struct btdev *btdev, uint8_t event, { void *pkt_data; + util_debug(btdev->debug_callback, btdev->debug_data, + "meta event 0x%02x", event); + pkt_data = alloca(1 + len); if (!pkt_data) return; @@ -2089,7 +2090,6 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, uint16_t type, bool is_scan_rsp) { struct __packed { - uint8_t subevent; uint8_t num_reports; union { struct bt_hci_le_ext_adv_report lear; @@ -2097,8 +2097,6 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, }; } meta_event; - meta_event.subevent = BT_HCI_EVT_LE_EXT_ADV_REPORT; - memset(&meta_event.lear, 0, sizeof(meta_event.lear)); meta_event.num_reports = 1; meta_event.lear.event_type = cpu_to_le16(type); @@ -2121,8 +2119,8 @@ static void send_ext_adv(struct btdev *btdev, const struct btdev *remote, meta_event.lear.data_len); } - send_event(btdev, BT_HCI_EVT_LE_META_EVENT, &meta_event, - 1 + 1 + 24 + meta_event.lear.data_len); + le_meta_event(btdev, BT_HCI_EVT_LE_EXT_ADV_REPORT, &meta_event, + 1 + 24 + meta_event.lear.data_len); } static uint8_t get_adv_report_type(uint8_t adv_type) @@ -3952,8 +3950,8 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, return; unsupported: - printf("Unsupported command 0x%4.4x\n", opcode); - hexdump(data, len); + util_debug(btdev->debug_callback, btdev->debug_data, + "Unsupported command 0x%4.4x\n", opcode); cmd_status(btdev, BT_HCI_ERR_UNKNOWN_COMMAND, opcode); } @@ -4267,6 +4265,9 @@ static void process_cmd(struct btdev *btdev, const void *data, uint16_t len) callback.data = data + sizeof(*hdr); callback.len = hdr->plen; + util_debug(btdev->debug_callback, btdev->debug_data, + "command 0x%04x", callback.opcode); + if (btdev->command_handler) btdev->command_handler(callback.opcode, callback.data, callback.len, @@ -4331,6 +4332,9 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len) if (len < 1) return; + util_hexdump('>', data, len, btdev->debug_callback, + btdev->debug_data); + pkt_type = ((const uint8_t *) data)[0]; switch (pkt_type) { @@ -4348,7 +4352,8 @@ void btdev_receive_h4(struct btdev *btdev, const void *data, uint16_t len) send_iso(btdev->conn, data, len); break; default: - printf("Unsupported packet 0x%2.2x\n", pkt_type); + util_debug(btdev->debug_callback, btdev->debug_data, + "Unsupported packet 0x%2.2x\n", pkt_type); break; } } diff --git a/emulator/btdev.h b/emulator/btdev.h index 7cb265f1c..f7cba149a 100644 --- a/emulator/btdev.h +++ b/emulator/btdev.h @@ -66,6 +66,11 @@ struct btdev; struct btdev *btdev_create(enum btdev_type type, uint16_t id); void btdev_destroy(struct btdev *btdev); +typedef void (*btdev_debug_func_t)(const char *str, void *user_data); +typedef void (*btdev_destroy_func_t)(void *user_data); +bool btdev_set_debug(struct btdev *btdev, btdev_debug_func_t callback, + void *user_data, btdev_destroy_func_t destroy); + const uint8_t *btdev_get_bdaddr(struct btdev *btdev); uint8_t *btdev_get_features(struct btdev *btdev); From patchwork Mon Nov 2 19:12:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875033 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DC5AC00A89 for ; Mon, 2 Nov 2020 19:12:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A75152225E for ; Mon, 2 Nov 2020 19:12:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ds50etqN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726473AbgKBTMh (ORCPT ); Mon, 2 Nov 2020 14:12:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726433AbgKBTMg (ORCPT ); Mon, 2 Nov 2020 14:12:36 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D55F2C0617A6 for ; Mon, 2 Nov 2020 11:12:36 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id w11so7301351pll.8 for ; Mon, 02 Nov 2020 11:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=AJ40uhAUVOG4HQ6xubmwRqCHUzL28Zk1s0d9ENX1l90=; b=Ds50etqNZ3UPYsIZgm+8agmXVwCuGlFK5GoUWXdyJ4kIJdXfEIK4AHwADtYAd3GW9I jjqplUxZEynDFyaEh7HulhMHqzYY9s7gyGszRy/lvpgsQpmB7uRbGlAfUySziiRknn/Y WdxuaLbLBGnFnbdjLztp2dLEGC/doR/ozdlyopCi1i8dbt0+YpybyhFnxGSkECm0vXuh 38HIb6HIv1oXauPvD6sc/djwdpQjpoOEn7MFFDDgq41cRihGHmPPqiE2y+yyBfJYX+sy Xz+/JI8wGnazGtppZJESdPWBLwuWdrnKBK5tHVMdLhDrEXISZkquh1XMqlH1yUXy7VyC meIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AJ40uhAUVOG4HQ6xubmwRqCHUzL28Zk1s0d9ENX1l90=; b=jZdV87GgXNEwg5En8cCjbnW/LGZa4pM8ZmUn3rR6SSgBQLWayC0iCzuOLlMh8NTgK9 BYONJxUOx+LX5/RE/PNhRv6ylgSvn0/+QT+jqqPwWP0AcI/zU9G99DjOQt3hknOtrOyZ aFKE9VU4Aa8hmH9KVCc4R97zF7jcAIKi7VrbXBeD8N3rpu+GIE5N2nQm8ay2+T5gyZsn xo4O5qc5qLNc31qDkLPespmzdYtABotawRE0RWKlNvD1vLa0tlQbIIb/8zrnFnPUS/Pe OOZV2QZq2bmZTdc/k/uwsNqMwpDTic+fvxKATOSYIF/3eMJt4Xq5iVSy0O82/Y18l3m8 t3BA== X-Gm-Message-State: AOAM5333eVmvh1abP/YAU8kCx6ci3ryDW6IMucQpmsSSeZ0J+YfeWCr1 6jpJHjrN5vmE4WnrMgsDFMgq2e06L1HWnQ== X-Google-Smtp-Source: ABdhPJxL5bj4v6pqD0CglvjBmgiMPG2+wfnufMvsxMaSQEaAzBum8+qIKGNKg6gQqcj+dvkEycUeeg== X-Received: by 2002:a17:902:8608:b029:d4:c459:f1e8 with SMTP id f8-20020a1709028608b02900d4c459f1e8mr21804171plo.36.1604344356078; Mon, 02 Nov 2020 11:12:36 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:35 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 02/11] emulator/bthost: Add debug support Date: Mon, 2 Nov 2020 11:12:23 -0800 Message-Id: <20201102191232.1848737-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds bthost_set_debug which can be used to debug internals of bthost. --- emulator/bthost.c | 73 ++++++++++++++++++++++++++++++++++++++++------- emulator/bthost.h | 5 ++++ 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/emulator/bthost.c b/emulator/bthost.c index 1c05c7496..f5b09bc4f 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -24,6 +24,7 @@ #include "lib/bluetooth.h" #include "src/shared/util.h" +#include "src/shared/tester.h" #include "monitor/bt.h" #include "monitor/rfcomm.h" #include "bthost.h" @@ -213,6 +214,10 @@ struct bthost { bool conn_init; bool le; bool sc; + + bthost_debug_func_t debug_callback; + bthost_destroy_func_t debug_destroy; + void *debug_data; }; struct bthost *bthost_create(void) @@ -487,9 +492,20 @@ static void queue_command(struct bthost *bthost, const struct iovec *iov, static void send_packet(struct bthost *bthost, const struct iovec *iov, int iovlen) { + int i; + if (!bthost->send_handler) return; + for (i = 0; i < iovlen; i++) { + if (!i) + util_hexdump('<', iov[i].iov_base, iov[i].iov_len, + bthost->debug_callback, bthost->debug_data); + else + util_hexdump(' ', iov[i].iov_base, iov[i].iov_len, + bthost->debug_callback, bthost->debug_data); + } + bthost->send_handler(iov, iovlen, bthost->send_data); } @@ -675,6 +691,9 @@ static void send_command(struct bthost *bthost, uint16_t opcode, uint8_t pkt = BT_H4_CMD_PKT; struct iovec iov[3]; + util_debug(bthost->debug_callback, bthost->debug_data, + "command 0x%02x", opcode); + iov[0].iov_base = &pkt; iov[0].iov_len = sizeof(pkt); @@ -759,6 +778,22 @@ void bthost_notify_ready(struct bthost *bthost, bthost_ready_cb cb) bthost->ready_cb = cb; } +bool bthost_set_debug(struct bthost *bthost, bthost_debug_func_t callback, + void *user_data, bthost_destroy_func_t destroy) +{ + if (!bthost) + return false; + + if (bthost->debug_destroy) + bthost->debug_destroy(bthost->debug_data); + + bthost->debug_callback = callback; + bthost->debug_destroy = destroy; + bthost->debug_data = user_data; + + return true; +} + static void read_local_features_complete(struct bthost *bthost, const void *data, uint8_t len) { @@ -835,7 +870,8 @@ static void evt_cmd_complete(struct bthost *bthost, const void *data, case BT_HCI_CMD_LE_SET_EXT_ADV_ENABLE: break; default: - printf("Unhandled cmd_complete opcode 0x%04x\n", opcode); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unhandled cmd_complete opcode 0x%04x", opcode); break; } @@ -1242,6 +1278,9 @@ static void evt_le_meta_event(struct bthost *bthost, const void *data, if (len < 1) return; + util_debug(bthost->debug_callback, bthost->debug_data, + "event 0x%02x", *event); + switch (*event) { case BT_HCI_EVT_LE_CONN_COMPLETE: evt_le_conn_complete(bthost, evt_data, len - 1); @@ -1259,7 +1298,8 @@ static void evt_le_meta_event(struct bthost *bthost, const void *data, evt_le_ext_conn_complete(bthost, evt_data, len - 1); break; default: - printf("Unsupported LE Meta event 0x%2.2x\n", *event); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unsupported LE Meta event 0x%2.2x", *event); break; } } @@ -1277,6 +1317,9 @@ static void process_evt(struct bthost *bthost, const void *data, uint16_t len) param = data + sizeof(*hdr); + util_debug(bthost->debug_callback, bthost->debug_data, + "event 0x%02x", hdr->evt); + switch (hdr->evt) { case BT_HCI_EVT_CMD_COMPLETE: evt_cmd_complete(bthost, param, hdr->plen); @@ -1343,7 +1386,8 @@ static void process_evt(struct bthost *bthost, const void *data, uint16_t len) break; default: - printf("Unsupported event 0x%2.2x\n", hdr->evt); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unsupported event 0x%2.2x", hdr->evt); break; } } @@ -1674,7 +1718,8 @@ static void l2cap_sig(struct bthost *bthost, struct btconn *conn, break; default: - printf("Unknown L2CAP code 0x%02x\n", hdr->code); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unknown L2CAP code 0x%02x", hdr->code); ret = false; } @@ -1892,7 +1937,8 @@ static void l2cap_le_sig(struct bthost *bthost, struct btconn *conn, break; default: - printf("Unknown L2CAP code 0x%02x\n", hdr->code); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unknown L2CAP code 0x%02x", hdr->code); ret = false; } @@ -2232,7 +2278,8 @@ static void process_rfcomm(struct bthost *bthost, struct btconn *conn, rfcomm_uih_recv(bthost, conn, l2conn, data, len); break; default: - printf("Unknown frame type\n"); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unknown frame type"); break; } } @@ -2257,7 +2304,8 @@ static void process_acl(struct bthost *bthost, const void *data, uint16_t len) handle = acl_handle(acl_hdr->handle); conn = bthost_find_conn(bthost, handle); if (!conn) { - printf("ACL data for unknown handle 0x%04x\n", handle); + util_debug(bthost->debug_callback, bthost->debug_data, + "ACL data for unknown handle 0x%04x", handle); return; } @@ -2293,8 +2341,9 @@ static void process_acl(struct bthost *bthost, const void *data, uint16_t len) if (l2conn && l2conn->psm == 0x0003) process_rfcomm(bthost, conn, l2conn, l2_data, l2_len); else - printf("Packet for unknown CID 0x%04x (%u)\n", cid, - cid); + util_debug(bthost->debug_callback, bthost->debug_data, + "Packet for unknown CID 0x%04x (%u)", + cid, cid); break; } } @@ -2309,6 +2358,9 @@ void bthost_receive_h4(struct bthost *bthost, const void *data, uint16_t len) if (len < 1) return; + util_hexdump('>', data, len, bthost->debug_callback, + bthost->debug_data); + pkt_type = ((const uint8_t *) data)[0]; switch (pkt_type) { @@ -2319,7 +2371,8 @@ void bthost_receive_h4(struct bthost *bthost, const void *data, uint16_t len) process_acl(bthost, data + 1, len - 1); break; default: - printf("Unsupported packet 0x%2.2x\n", pkt_type); + util_debug(bthost->debug_callback, bthost->debug_data, + "Unsupported packet 0x%2.2x", pkt_type); break; } } diff --git a/emulator/bthost.h b/emulator/bthost.h index 3841f98a1..77f17fd69 100644 --- a/emulator/bthost.h +++ b/emulator/bthost.h @@ -23,6 +23,11 @@ void bthost_destroy(struct bthost *bthost); typedef void (*bthost_ready_cb) (void); void bthost_notify_ready(struct bthost *bthost, bthost_ready_cb cb); +typedef void (*bthost_debug_func_t)(const char *str, void *user_data); +typedef void (*bthost_destroy_func_t)(void *user_data); +bool bthost_set_debug(struct bthost *bthost, bthost_debug_func_t callback, + void *user_data, bthost_destroy_func_t destroy); + void bthost_set_send_handler(struct bthost *bthost, bthost_send_func handler, void *user_data); From patchwork Mon Nov 2 19:12:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875045 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F28AC388F9 for ; Mon, 2 Nov 2020 19:12:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0721C2225E for ; Mon, 2 Nov 2020 19:12:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VcTTSU2f" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgKBTMi (ORCPT ); Mon, 2 Nov 2020 14:12:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMi (ORCPT ); Mon, 2 Nov 2020 14:12:38 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2B34C0617A6 for ; Mon, 2 Nov 2020 11:12:37 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id w11so7301374pll.8 for ; Mon, 02 Nov 2020 11:12:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=9X36yZqsc5IH2GNoTHG/441w3rHF6SH1q4Yn51/UZ5A=; b=VcTTSU2fZdcl7hSWV0Ygcd2cb+hZjP1lM//MPWjJ4wIhZ/egtysjKM+4njAE9whnKN zrGCEwDMhRGnfKQOUm7IXT/yQdI4WvtXjNWeOh0i5MxagSNdrjalRUvl7kSHsfD9z6NT 9wTlHo+GsDEKKOR0cpXqR2WPEdKd7g7PEPn8d6QCATWvRvFag3Boi63Vnj3sJCbdEipV LZYk7Pf0lX1/60V9NZEtMDzBSODoi9Yf8zFl/1cc8eL2dLUAJR4ffBJWNQ49LtsNudlk gKBeQycFh9rQ4steTWRDUVCPJz0tpouv+oNApQnrLxRS0TzkNbpblNZsvNSZrcG54RX1 wGVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9X36yZqsc5IH2GNoTHG/441w3rHF6SH1q4Yn51/UZ5A=; b=DvfnbdDNXT6dGVSPoMJkA8dGwdupMM2QEzEMjKU2ChRwdvxgYHN8sCYHE7f6vApCct PMW2nWRDZ0cuHbQxgZHTXaW02pPfVNz65bFdWQJ02iey3hBMK2BPjm+ovGTp22Vp/0eM K1jbUfQA258XLMUdvCdr8z/9XmQicoYdg4nugQAX25nvQ+oeZ+VyballhLjWGRkNAeuo kuTt5+KgFGIBP0+dwiQcVl5svWT8Wr0B3ihzMU6jRwGQ1xPefvq+pRU+J5TbsB5By2fU ag5v060wD5R+tovQ0c+GvsdOT57pmCJ7X/RHVnoeQWBp4F8tNUZWVsHpO3RkGafjv1GA AiPw== X-Gm-Message-State: AOAM530vcrpdyX/qKA/UjCT1qDMH/2tDCkWXLBb/Xdbe6GMQYwLbSA3/ 8BwgKBOPkSDjyuSjBwivl50PEhKwYO61Lw== X-Google-Smtp-Source: ABdhPJyq5Knv11YsoSC+RPoHUfdHJBEaF/GqOEXnmZd8LgpuPME5m4OOJMkh6V0hX/piyvH78xhMcA== X-Received: by 2002:a17:902:9049:b029:d5:eadd:3d13 with SMTP id w9-20020a1709029049b02900d5eadd3d13mr21835420plz.15.1604344356985; Mon, 02 Nov 2020 11:12:36 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:36 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 03/11] emulator/hciemu: Add debug support Date: Mon, 2 Nov 2020 11:12:24 -0800 Message-Id: <20201102191232.1848737-3-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This adds bthost_set_debug which can be used to debug internals of hciemu. --- emulator/hciemu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ emulator/hciemu.h | 5 +++++ 2 files changed, 53 insertions(+) diff --git a/emulator/hciemu.c b/emulator/hciemu.c index fa8905ed7..fd6029deb 100644 --- a/emulator/hciemu.c +++ b/emulator/hciemu.c @@ -45,6 +45,10 @@ struct hciemu { guint client_source; struct queue *post_command_hooks; char bdaddr_str[18]; + + hciemu_debug_func_t debug_callback; + hciemu_destroy_func_t debug_destroy; + void *debug_data; }; struct hciemu_command_hook { @@ -385,6 +389,50 @@ void hciemu_unref(struct hciemu *hciemu) free(hciemu); } +static void bthost_debug(const char *str, void *user_data) +{ + struct hciemu *hciemu = user_data; + + util_debug(hciemu->debug_callback, hciemu->debug_data, + "bthost: %s", str); +} + +static void btdev_master_debug(const char *str, void *user_data) +{ + struct hciemu *hciemu = user_data; + + util_debug(hciemu->debug_callback, hciemu->debug_data, + "btdev: %s", str); +} + +static void btdev_client_debug(const char *str, void *user_data) +{ + struct hciemu *hciemu = user_data; + + util_debug(hciemu->debug_callback, hciemu->debug_data, + "btdev[bthost]: %s", str); +} + +bool hciemu_set_debug(struct hciemu *hciemu, hciemu_debug_func_t callback, + void *user_data, hciemu_destroy_func_t destroy) +{ + if (!hciemu) + return false; + + if (hciemu->debug_destroy) + hciemu->debug_destroy(hciemu->debug_data); + + hciemu->debug_callback = callback; + hciemu->debug_destroy = destroy; + hciemu->debug_data = user_data; + + btdev_set_debug(hciemu->master_dev, btdev_master_debug, hciemu, NULL); + btdev_set_debug(hciemu->client_dev, btdev_client_debug, hciemu, NULL); + bthost_set_debug(hciemu->host_stack, bthost_debug, hciemu, NULL); + + return true; +} + const char *hciemu_get_address(struct hciemu *hciemu) { const uint8_t *addr; diff --git a/emulator/hciemu.h b/emulator/hciemu.h index c8ec80d8d..d0708277d 100644 --- a/emulator/hciemu.h +++ b/emulator/hciemu.h @@ -34,6 +34,11 @@ struct hciemu *hciemu_new(enum hciemu_type type); struct hciemu *hciemu_ref(struct hciemu *hciemu); void hciemu_unref(struct hciemu *hciemu); +typedef void (*hciemu_debug_func_t)(const char *str, void *user_data); +typedef void (*hciemu_destroy_func_t)(void *user_data); +bool hciemu_set_debug(struct hciemu *hciemu, hciemu_debug_func_t callback, + void *user_data, hciemu_destroy_func_t destroy); + struct bthost *hciemu_client_get_host(struct hciemu *hciemu); const char *hciemu_get_address(struct hciemu *hciemu); From patchwork Mon Nov 2 19:12:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875037 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25768C00A89 for ; Mon, 2 Nov 2020 19:12:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C80C5222BA for ; Mon, 2 Nov 2020 19:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZVGCdZEN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbgKBTMj (ORCPT ); Mon, 2 Nov 2020 14:12:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMi (ORCPT ); Mon, 2 Nov 2020 14:12:38 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B03B0C0617A6 for ; Mon, 2 Nov 2020 11:12:38 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id x23so7319683plr.6 for ; Mon, 02 Nov 2020 11:12:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y5r28XmAxF0NNbIcT2BD4Vqev34gsw4BOZU4JB5iY+o=; b=ZVGCdZENno/uNUOa5iU8Tx5ComRRtvsWg5Pr990rirb5T2n9pRgYu5LOk7hE6g4NTS 3HfnAIHsTfFQ6B2PpXHAb3djDYpEn1UX/xWaZD4fNFfS8MkGu65UskLoSKOB/tO2NMlt 1UelIIpYJNvf0UNQcQXUl1CS8SN2rV+AYzSDCBOV87UzC5jN2lvcidD0iRuAn5j3F1Ej sLL/KIYYctqKUitf3dEQQqU7nk2xJmc6eA75c48Dec542/zidFza5lQQy5/3FkBBFGLk o8t/obBjWBi/XROLnL/THbmkqbccElme5RbR4CUx1g590ppuB6Ek9PnMyb2jUzs39E/r mVhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y5r28XmAxF0NNbIcT2BD4Vqev34gsw4BOZU4JB5iY+o=; b=jMX0u8KL5GITh22QmKijqOnssv/8Nfd0i3gwgh/azudVceenEPchMwXxpOAbVuyr1S Q023DZFrhpYq22rCIjjLiKXI3j2qjN2YI+JG2wrYjTqFCEUcByK5/oQJh5Lc3bCbpTIb KvjqYgSUCq17+HWgTIFw6dbfLPZwUokeSPuNohqzD7BPY1mYJ2HA+YtDYmqyRz7IgZBY NYwbOdDLDSO++buoafZ51DiQGUMNuGevhncZZCvIR5OfRmBADbIVkdGr70jMESTpLOKj j2nnMqdyDOyZn65dyuWJW2mj5EyLxA1Zg2vet1gIZEstgTrLS/u1KcWLG8ztzDw8V5hZ m9TQ== X-Gm-Message-State: AOAM532QSJIZozGu5UWfOg4m3u9p9eFwHFLgKJ8XT96amXaHd72T6x8/ BBurpU3hHyikcLCGx34XjXSjD8T5XHP5Bg== X-Google-Smtp-Source: ABdhPJzTQapwz61h0mQsqZ20w783VMN1baMIrsxmz2Bw6q93/7xzKyWHG8vgiFtMSaYiXEHy5wHYhQ== X-Received: by 2002:a17:902:9a89:b029:d6:c37c:7c69 with SMTP id w9-20020a1709029a89b02900d6c37c7c69mr9012957plp.11.1604344358070; Mon, 02 Nov 2020 11:12:38 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:37 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 04/11] emulator: Fix not gerating proper advertisement Date: Mon, 2 Nov 2020 11:12:25 -0800 Message-Id: <20201102191232.1848737-4-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz When a btdev instance advertise using the legacy command and the other instance uses the extended version to scan the report type are not actually setting the legacy PDU properly. --- emulator/btdev.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/emulator/btdev.c b/emulator/btdev.c index c89815b3e..42276a2ce 100644 --- a/emulator/btdev.c +++ b/emulator/btdev.c @@ -2154,6 +2154,29 @@ static uint8_t get_ext_adv_type(uint8_t ext_adv_type) return ext_adv_type; } +static uint16_t ext_legacy_adv_type(uint8_t type) +{ + switch (type) { + case 0x00: + /* Connectable undirected - ADV_IND" */ + return 0x0013; + case 0x01: + /* Connectable directed - ADV_DIRECT_IND */ + return 0x0015; + case 0x02: + /* Scannable undirected - ADV_SCAN_IND */ + return 0x0012; + case 0x03: + /* Non connectable undirected - ADV_NONCONN_IND */ + return 0x0010; + case 0x04: + /* Scan response - SCAN_RSP */ + return 0x0012; + } + + return 0x0000; +} + static void le_set_adv_enable_complete(struct btdev *btdev) { uint8_t report_type; @@ -3413,6 +3436,8 @@ static void default_cmd(struct btdev *btdev, uint16_t opcode, lsap = data; btdev->le_adv_type = lsap->type; + /* Use Legacy PDU if the remote is using EXT Scan */ + btdev->le_ext_adv_type = ext_legacy_adv_type(lsap->type); btdev->le_adv_own_addr = lsap->own_addr_type; btdev->le_adv_direct_addr_type = lsap->direct_addr_type; memcpy(btdev->le_adv_direct_addr, lsap->direct_addr, 6); From patchwork Mon Nov 2 19:12:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875043 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C520C2D0A3 for ; Mon, 2 Nov 2020 19:12:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0320222BA for ; Mon, 2 Nov 2020 19:12:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G6/spdxv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbgKBTMk (ORCPT ); Mon, 2 Nov 2020 14:12:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMj (ORCPT ); Mon, 2 Nov 2020 14:12:39 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9072DC0617A6 for ; Mon, 2 Nov 2020 11:12:39 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id c20so11959662pfr.8 for ; Mon, 02 Nov 2020 11:12:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y7gtfVrPuzt8dCsXuLb6bKQr3QEbKfNBjjypNUaqPo4=; b=G6/spdxviYtr8/qPQwltWT5gZ3sRIPUIpG+7xvSTyXfCCf8+0KjkwvlnjyLsvlIYZn vcSO7z7WoDyhBzrA5mI54t4+Oo2ThPQr5c0rwMyToY+tY7WX6F+wmro4gyMvRN7LqYHf 5I+IApOyaT0UnLFYRrMuDhjQq6ZuxoETe+GVPzp6Ahs0U0WWYJqNKAiatJBDko9WEZAv FnyOmYE5D8wQu7wV5AFaoEJJ8TkminlFZn+Gz3aj5Y0DjWpKx8KbVVXruOjiEAksZmFg S5/rDEZ4mpugcQu3Y2PswmB43c1r90D7e8qTV56Xdw08FSdBamszlr8MO1JkJZ1WkblU +nRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y7gtfVrPuzt8dCsXuLb6bKQr3QEbKfNBjjypNUaqPo4=; b=ThhvuPt5KYSwQ2XQYYH1+jY6DzjVn+Zks6zIG8j0wwEWR1C9BQXpc62FEkJfGeID2s IzNWfGnxuhNbfP7mRvr4UWkve8zfV0uI89w2sBtRCWdVwa7rM4a+Otp1dtcBETEPPRcv IM1YkDacgLMTkExhSLI7x02tjodYFGckIMe67tCUPSkuoLgPbTgzz+mXn6F6Ra8d4dFY 6NpMcb4wAcFl0VaH9eXlXGhxGEKmcdZX4dHdtzNP8eCxSYkGrWKoL6i+D5lYvhffLzda 6W5v7wlQU/jFmyU1jSstHgGgBnKV1vRxEyoPS28/JM8DsagXKNy6OFCe1lmuaB6tgNLp PtSg== X-Gm-Message-State: AOAM530b4pfHLpeMN3DKNXr8IG/qNqgDX0fn1Pn68DnBbfIqbXqZ1lDB GACusZspigLOaYn9yEjxXPN4rUFyWhoj0Q== X-Google-Smtp-Source: ABdhPJy1G9tg+mYVT3yJG0stAopuktMvaqUyCaOPA2J5REYpOEL3X4j7le5JcazGX1l8u0nTc0MIEw== X-Received: by 2002:a17:90a:5906:: with SMTP id k6mr13743739pji.173.1604344358881; Mon, 02 Nov 2020 11:12:38 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:38 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 05/11] emulator/bthost: Add support for LE CIS Request Date: Mon, 2 Nov 2020 11:12:26 -0800 Message-Id: <20201102191232.1848737-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enables bthost to act as acceptor of LE CIS Request. --- emulator/bthost.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/emulator/bthost.c b/emulator/bthost.c index f5b09bc4f..32676e179 100644 --- a/emulator/bthost.c +++ b/emulator/bthost.c @@ -1269,6 +1269,21 @@ static void evt_le_ltk_request(struct bthost *bthost, const void *data, sizeof(cp)); } +static void evt_le_cis_req(struct bthost *bthost, const void *data, uint8_t len) +{ + const struct bt_hci_evt_le_cis_req *ev = data; + struct bt_hci_cmd_le_accept_cis cmd; + + if (len < sizeof(*ev)) + return; + + memset(&cmd, 0, sizeof(cmd)); + + cmd.handle = ev->cis_handle; + + send_command(bthost, BT_HCI_CMD_LE_ACCEPT_CIS, &cmd, sizeof(cmd)); +} + static void evt_le_meta_event(struct bthost *bthost, const void *data, uint8_t len) { @@ -1297,6 +1312,9 @@ static void evt_le_meta_event(struct bthost *bthost, const void *data, case BT_HCI_EVT_LE_ENHANCED_CONN_COMPLETE: evt_le_ext_conn_complete(bthost, evt_data, len - 1); break; + case BT_HCI_EVT_LE_CIS_REQ: + evt_le_cis_req(bthost, evt_data, len - 1); + break; default: util_debug(bthost->debug_callback, bthost->debug_data, "Unsupported LE Meta event 0x%2.2x", *event); From patchwork Mon Nov 2 19:12:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875039 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25442C00A89 for ; Mon, 2 Nov 2020 19:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BCB3C223C6 for ; Mon, 2 Nov 2020 19:12:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hQb24HA3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726506AbgKBTMl (ORCPT ); Mon, 2 Nov 2020 14:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMk (ORCPT ); Mon, 2 Nov 2020 14:12:40 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACA62C0617A6 for ; Mon, 2 Nov 2020 11:12:40 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id k9so9923598pgt.9 for ; Mon, 02 Nov 2020 11:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=p6zFEWWjrbnIsNveDFpaCjXAaAfiaBx/ZmPp8bu4Hvw=; b=hQb24HA3tSpCKfnpxOXqxizsIMsGDSNKUIUifnBKUuHkZ58VXDqXirLuaEBB7lFFiG nP1eStdD7K2cdqss4J5kY5yn7ctRe5SWM0kYX7XEQQ0B8lDCWLmWcajWCmUeMzQvnOLc OIQKo9k3PbAKD9jV9FLf0+ShrotV+kALP6PS5pDYfet0GZ8CUJn5KRX2NDEnGk7h48gf XEuwvZsRNORk3/MF5Sxd5sVcBDynRKRee+qR0lIH8gh0ss7Ko1cUEUhxGI0dufKsT11V ey7MNgzOT9olxvJoVnErmqN/0j39XrciN208yRapurQHRtgKGztkxXIDAcz1JIJnqDOa J7Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p6zFEWWjrbnIsNveDFpaCjXAaAfiaBx/ZmPp8bu4Hvw=; b=PzvLLhVIqJR7Tc56wrxF5SsqLIb8zD6qYjMB2f47cY1psO6/fTOtjP2eCNp7I5L09b p2WveIqfjXMl5WE4CgVMGqQbvGh4QShMOhlkdwT2mlbzSEEwVqjqWfKcxlfoOUXsq2OT ZPaprJ83gxL9pH8CCcGTHO8Ew+1WKFnz3mI+3gJ0WnfDbRxW8JEAlFuCSaZIu9rXhBv1 5HOzoqSOSLHFVZSPH6SqsjH7BdplmeZjNjw2mWWdHgBAU8gyLCzCK5Znesery5cv2x8Y Jk4LulThy+fSjDwwI/cUGoa+Ek2J3JHHbH8U5n7i+fYyNRzzxDiHNkjYUeeeLUrTs/Kh 4l6Q== X-Gm-Message-State: AOAM533Vc+OK8kEmeDqTprJs3NyyHElDvPJUzOZRXwd14tqaSeWncL6e e0LzdIZrBuRMeClOgWlTX4KnBr1GNmDwng== X-Google-Smtp-Source: ABdhPJw3646l6h95ky9/GEETBWP3hz22VOnlZ9mSGEG2LjzG8O9685gNawwIY4fC3oTCCCPop/n7Nw== X-Received: by 2002:a63:5c5e:: with SMTP id n30mr14280998pgm.54.1604344360011; Mon, 02 Nov 2020 11:12:40 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:39 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 06/11] tools/l2cap-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:27 -0800 Message-Id: <20201102191232.1848737-6-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/l2cap-tester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/l2cap-tester.c b/tools/l2cap-tester.c index 42d2b5615..ff641ba1d 100644 --- a/tools/l2cap-tester.c +++ b/tools/l2cap-tester.c @@ -85,7 +85,7 @@ struct l2cap_data { bool shut_sock_wr; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -190,6 +190,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, tester_pre_setup_failed(); } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + tester_print("New hciemu instance created"); } @@ -205,7 +208,7 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); mgmt_send(data->mgmt, MGMT_OP_READ_INDEX_LIST, MGMT_INDEX_NONE, 0, NULL, read_index_list_callback, NULL, NULL); From patchwork Mon Nov 2 19:12:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875041 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C5A5C388F9 for ; Mon, 2 Nov 2020 19:12:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9DA0C222BA for ; Mon, 2 Nov 2020 19:12:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vSZxkdlo" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726513AbgKBTMm (ORCPT ); Mon, 2 Nov 2020 14:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMl (ORCPT ); Mon, 2 Nov 2020 14:12:41 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3D9C0617A6 for ; Mon, 2 Nov 2020 11:12:41 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id b3so11991595pfo.2 for ; Mon, 02 Nov 2020 11:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=/5LxbC8AHpc+T92VJcOJP+JYNMbjkLARoQjE1/pTfi0=; b=vSZxkdloKY3bhbSEEyhvlJUA7Ag+qEPAd3FQd3qkzQ8wWXyEoCk7PpMrA5on2qgZch sOI/dtqOYEBofrC9u0OGpaNCX+jM/Uujl9hAKawovDJwO//5HtbIK9p25yel1i4w2+Dt 2Vy43+q8GzDdbHFqZVeVUHgYNUIADOcAt3G+qy2ckXKo66ul8F/RAANszoUf0EJdAKWs I7ThecoXGrmTB0BQ5eKUE56VWEjpzrS2Z88Blv8WbqY6UXejXbMR+7ourwl70cdchTr/ dvvwXkcQA48IciCCfkbGR3f4hE6FULCwfc4KoELzXlGqM96bl+y/jkIoO1FLS7ucMiZg VvFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/5LxbC8AHpc+T92VJcOJP+JYNMbjkLARoQjE1/pTfi0=; b=Tf20HVPE6rT9Wv49dMW8m1BzsVTDlchvv05r1a0RR2OQOi2gwWadR3CSuXV+Y9xONv wO1jxgjtO0ikUD2BwHOPqm1XgZcXYUpidSJc1RQX4OAqZYZMNYG4E2rBTapnvqJvcmI+ PO04slTvKQXYb3tqQfDqiwh/PQCo8iOErf8YOzAg7VaKLokBiQgavorGluFZbqMsDPBA 0BMJD1vbYRs3BORibnbq8nauw/I/3YcX8lN8iUP1jV3tJ1BSj8/mWhv/tBj4M/ci1C9o QMyrW6k2HKRtsTkKUNo4ycTzwfbQNzyjTHeg61Fq0o0DI662K9x24vAD/5qOHVLz6loV cckg== X-Gm-Message-State: AOAM531CopzpRE5TDZcN3NjJpCpcOBx7qOisvoWJi/lL0TBiiW0FgCeK yhzWS7OKhQSNKUJh0I4v0xUf1myJzpQQ0Q== X-Google-Smtp-Source: ABdhPJzECqjr6yC5p1vYHwuwN0B4q6L6ria8YY0DQjPWaRKEHSh/ZlUdDXhYjUtjOjt13mRCr6IDCg== X-Received: by 2002:a17:90a:ea85:: with SMTP id h5mr12625243pjz.26.1604344360838; Mon, 02 Nov 2020 11:12:40 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:40 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 07/11] tools/mgmt-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:28 -0800 Message-Id: <20201102191232.1848737-7-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/mgmt-tester.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/mgmt-tester.c b/tools/mgmt-tester.c index 3b722207f..27a5f0bab 100644 --- a/tools/mgmt-tester.c +++ b/tools/mgmt-tester.c @@ -57,7 +57,7 @@ struct test_data { int sk; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -285,6 +285,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, tester_pre_setup_failed(); } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + if (test && test->setup_le_states) hciemu_set_master_le_states(data->hciemu, test->le_states); } @@ -311,8 +314,8 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) { - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); - mgmt_set_debug(data->mgmt_alt, mgmt_debug, "mgmt-alt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt_alt, print_debug, "mgmt-alt: ", NULL); } mgmt_send(data->mgmt, MGMT_OP_READ_VERSION, MGMT_INDEX_NONE, 0, NULL, From patchwork Mon Nov 2 19:12:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875051 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0802C4742C for ; Mon, 2 Nov 2020 19:12:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A26D222BA for ; Mon, 2 Nov 2020 19:12:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V9cewqXg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726525AbgKBTMm (ORCPT ); Mon, 2 Nov 2020 14:12:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMm (ORCPT ); Mon, 2 Nov 2020 14:12:42 -0500 Received: from mail-pg1-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66937C0617A6 for ; Mon, 2 Nov 2020 11:12:42 -0800 (PST) Received: by mail-pg1-x533.google.com with SMTP id i7so9685923pgh.6 for ; Mon, 02 Nov 2020 11:12:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=HteQAn3IGqjmxIHgroMoj4yWs2m49AZfmpW8oo2dT5Q=; b=V9cewqXgniNaADfcUcj7ITXJwO8wFjM9vPG1ZLgqncwV4bDD7lh0vruQLtXw9NFq90 45An1hkLpQLQYpuz+uK/lCFyXoNXDW6rrRNugKxpZQWRn3JEYprVwWXTD+vaXEki3giK hqffsMIO3dzecjeF9UbvUjTvI+8p9/DcyRmUQ7ELBYbDwbZr/11ragcWLdf3jwsTySJb rZHKYlc0D3ZsGMOhMtNw8LdaM156etLBNEOm7pq4JxA1SHVWWvd1XRJKXFZns9tFzQPA 9fm1S2Q7wCJvcSXJFSmQf9Rr/Td+tFPOLB0eBGye/yPqsPe3PE+aB5nZfSVk88Zs/Pz+ /JlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HteQAn3IGqjmxIHgroMoj4yWs2m49AZfmpW8oo2dT5Q=; b=CWE2rYmGD8G+K7SEB6KE5LjFD9DhEaJVzm2Vztl0JhxvD50xHu6zKGlHmOoXwhkGlC YKcjc2HrGZaVgOlt9cgtY3uVSt+0yZ5sswwSGpwA9t6JginSTDvtO98MfKabNiO+/xkS +wD0F1nx4XzzIXOebSvKtTv+D31gHWagNIdzc7dosqM6m0LBg/1VP3qHBUtpAI88WONy PsxUvrXijfmLU80hPl07y/FwoLByTvtgAbQexRo1Zua5tYo1XD1votK/ag/UIohAhbS6 W6onzsylT7W9AKQ5em73/sTcW5NBL1iESGoK6IQb5yB1nk7CM6CQ6FksdQpyzx4esgXf BnzQ== X-Gm-Message-State: AOAM531oFhHvDhBD+vzx0fRQqyAL61YEW7SPlIF8o/wVKbSRcWjw31Rt oG8DGSEXaIIOf3VBxfLNnqbGBVcXOArZ0A== X-Google-Smtp-Source: ABdhPJzwCwsczpZqs31v+OA5xAoeK6ls5BtXAQP/FrhQ7teE2Hf5kKFUvDHc+47GJdtu34n6QDrqlg== X-Received: by 2002:a63:100e:: with SMTP id f14mr860762pgl.8.1604344361803; Mon, 02 Nov 2020 11:12:41 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:41 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 08/11] tools/bnep-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:29 -0800 Message-Id: <20201102191232.1848737-8-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/bnep-tester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/bnep-tester.c b/tools/bnep-tester.c index dfeb0ed0b..5e4d7fb6d 100644 --- a/tools/bnep-tester.c +++ b/tools/bnep-tester.c @@ -59,7 +59,7 @@ struct rfcomm_server_data { uint16_t data_len; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -164,6 +164,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, tester_pre_setup_failed(); } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + tester_print("New hciemu instance created"); } @@ -179,7 +182,7 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); mgmt_send(data->mgmt, MGMT_OP_READ_INDEX_LIST, MGMT_INDEX_NONE, 0, NULL, read_index_list_callback, NULL, NULL); From patchwork Mon Nov 2 19:12:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875049 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 976FEC00A89 for ; Mon, 2 Nov 2020 19:12:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 432EC22280 for ; Mon, 2 Nov 2020 19:12:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CD2RhUpj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbgKBTMn (ORCPT ); Mon, 2 Nov 2020 14:12:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMn (ORCPT ); Mon, 2 Nov 2020 14:12:43 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A31C0617A6 for ; Mon, 2 Nov 2020 11:12:43 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id x13so11603908pgp.7 for ; Mon, 02 Nov 2020 11:12:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=crIjpBLX3zf442PLoXns/F6GX0fRHqJTvt6ye9N9+kc=; b=CD2RhUpjzs3X8t6qKhqfblVYRLP13+CLc9LnHewN7Jz47afNpo8hn+aS2otYMT4t70 zpGTEzbA5hiWHiipN3gNg8EIFt+BlbdwJ5Q6XRCfM3h/GKy9w73sH6ZhDdsZ5bi+giZa 9z7z/HTBqrCHcZCbQg9sWpdp88creY87nULUZsiee5HrqzqIv7aXBM0O7NgFYncX/KfR UYLtRJ1UlURb4eErGByDOFU5VKSGMFJ5CaLYzoDPG8UPjPOhEGVD9AaX0zFg9EStId/N FfoeBpwMyWiENKfuRJdn/nyUfDu8vTE10vG3shdE3YRgDDpFsPxu/2+RXyBZcvv8iq+W iTkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=crIjpBLX3zf442PLoXns/F6GX0fRHqJTvt6ye9N9+kc=; b=Kl11So1N1ktOcb9Dluilm+vzxXGDpObfL6LB97NgDxO9PtWDtR/laFt1XwWxVCnLEB M4B7k87Fr5g5f8n3QKIRTv22iwhmar7S1BEo4LnOAWGITGFEiJCWxQ8WYNFpCQL5G0qP XJ/sUDqEbDGFdLLtRnB5lQitP43ThKTo4jv46gTPrFdszaTMPsU+htmWp4oFJhYxmVOu zduUELsyOJetb/L1Ff3BDuhT7vOw/A/q30rCjmj7+syTnDdthUsIKD/AmjGsrjpvF8fy BhRNH9yiNL/WoJR8DQ5kdF9GFd7IQQ0Bqfq1zbExEk6LEj0fdUWrmvw0HwwkmrWKAha0 v6lw== X-Gm-Message-State: AOAM5306m2w5JY9Re/6m0nVKn4gzijAvhtlR62bohDBOTLBCR43dCT27 wfdi/kcY/z+pKbKCFTAP6h0jnZ8siK32Zg== X-Google-Smtp-Source: ABdhPJy8USXlLaaf/qsD1VPGRJkiCiVX3h7+SnYTd7GwSwbZNdhBCW+2If6vAAtitjy7NADezZP69Q== X-Received: by 2002:a63:c154:: with SMTP id p20mr14791686pgi.252.1604344362785; Mon, 02 Nov 2020 11:12:42 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:42 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 09/11] tools/rfcomm-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:30 -0800 Message-Id: <20201102191232.1848737-9-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/rfcomm-tester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c index dcf19ecd2..9bae5b9d5 100644 --- a/tools/rfcomm-tester.c +++ b/tools/rfcomm-tester.c @@ -59,7 +59,7 @@ struct rfcomm_server_data { uint16_t data_len; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -164,6 +164,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, tester_pre_setup_failed(); } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + tester_print("New hciemu instance created"); } @@ -179,7 +182,7 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); mgmt_send(data->mgmt, MGMT_OP_READ_INDEX_LIST, MGMT_INDEX_NONE, 0, NULL, read_index_list_callback, NULL, NULL); From patchwork Mon Nov 2 19:12:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875047 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1EF6C388F9 for ; Mon, 2 Nov 2020 19:12:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5126E22280 for ; Mon, 2 Nov 2020 19:12:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XZq+PPeg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726552AbgKBTMo (ORCPT ); Mon, 2 Nov 2020 14:12:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMo (ORCPT ); Mon, 2 Nov 2020 14:12:44 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AB6EC0617A6 for ; Mon, 2 Nov 2020 11:12:44 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id u2so1367515pls.10 for ; Mon, 02 Nov 2020 11:12:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=EWB17hPUKy6O2d/REkLqtreSkP7cey2vDyPWNOp7Ugw=; b=XZq+PPeglyEOSi/KSRD/NAXbVirYNIIc7azOIP3JersFq9gvYoweYHdhq0JQkgL0lm zxHm3s0H4yfcDopndRdkBi5so71Mp73S/1B1UlhdGPftPRqy0fVAOxVj17vOfohSEJec Z7w2+V0vFzz1mHXwLYCVhfcDwms75ncvjPuPLl1dpnottsvEiINEb6xkXSIi6O+AI4QZ Cl0eNzZPQhGXzjO3OPOPWCR2vNdbxI7CWzxQJfjbhqzuyB6Z+VqBOukhFBhevdJhR22z oOrFjAE59lrYg4vP01eP9XwO9qjDlzj5V9VxxRfZQTKiRgPX5m70nqwQIyDCrQXneKHR L6UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EWB17hPUKy6O2d/REkLqtreSkP7cey2vDyPWNOp7Ugw=; b=lvu7a1N9ytcLnrniaaolPomF6+pWsF+XFr4g/dnkhUV1KSfBhvL84QtycyO04cytoJ FDEMrzD1BS0QW1NZD/Gi4Jyl79xYiKyQIwmkK2Dpigj9kj87K4wEqmbbhsdxlpMNlxqA 6ZJZZqj1WnlW5rZ8kR1HF0N0UerjQ/0G/Cpl+zqukn5YIuOinYcxvN9sxdCN2kShh08C kvMIPzq1h5Vx9xfYaip79QlfekOil6UhADWX+/EhPUAhQvdinjC3djuYoMbyN13nOGMw nkoxVYIueADJsc2c0gB5PGnCgLp+rZlqH1QVrnfiZL8B3HiSYjUtcSz2ugYqRnt289Kf kjaA== X-Gm-Message-State: AOAM531FPpA7VV39YVU77GG6OLMJDdaw3do1jwPEZz37eP5Ien6VFbo1 zfcAdoBgrI436FefbbjaYnp0iv9J0lSh2w== X-Google-Smtp-Source: ABdhPJzuVB4G+Y7bwsLf6ErzQxkCOqnUwCGphjFSYpNY+QhaqSc4TvNm7an7XtdEJxKakjygIKQ4Ng== X-Received: by 2002:a17:902:ee85:b029:d6:c43e:2321 with SMTP id a5-20020a170902ee85b02900d6c43e2321mr8063065pld.29.1604344363790; Mon, 02 Nov 2020 11:12:43 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:43 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 10/11] tools/sco-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:31 -0800 Message-Id: <20201102191232.1848737-10-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/sco-tester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/sco-tester.c b/tools/sco-tester.c index 471f89418..2b8dc0d4a 100644 --- a/tools/sco-tester.c +++ b/tools/sco-tester.c @@ -44,7 +44,7 @@ struct sco_client_data { int expect_err; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -150,6 +150,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, return; } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + tester_print("New hciemu instance created"); if (data->disable_esco) { @@ -175,7 +178,7 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); mgmt_send(data->mgmt, MGMT_OP_READ_INDEX_LIST, MGMT_INDEX_NONE, 0, NULL, read_index_list_callback, NULL, NULL); From patchwork Mon Nov 2 19:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Augusto von Dentz X-Patchwork-Id: 11875053 X-Patchwork-Delegate: luiz.dentz@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA05EC00A89 for ; Mon, 2 Nov 2020 19:12:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5168122280 for ; Mon, 2 Nov 2020 19:12:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ptJ7ix4F" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbgKBTMp (ORCPT ); Mon, 2 Nov 2020 14:12:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbgKBTMp (ORCPT ); Mon, 2 Nov 2020 14:12:45 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DD29C0617A6 for ; Mon, 2 Nov 2020 11:12:45 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id k9so9923746pgt.9 for ; Mon, 02 Nov 2020 11:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=WGRil8ABN5YSJ0xudApipfKKb7KRCUPpKNOrW5HAdfg=; b=ptJ7ix4FRnUFQlnAcBkZXGtFCEm6m5jgmcdtQKOPgQ7MI8fZFss5OVqEjBfM5fzmZ4 tWBrxxKSsYW0DbGq2oBp6ujh+/ENJcTbH/CQMiVjrUSQh17Mr3gA4rZjpAL2IyN8uD0X 7paHm+JroetsYUrI63jSQVXN428SwcvoUEvUDcST0+3TR+N6JdEOmXBpqga68o/DsK93 i0SNmcIvXTIys8+8LeUU3PbkjiBiSKBkfCsBdz+VHpi7mFl0tzx2ryeXjaTbnNFinRXh VfFe5x2Ko5yEriKIPWoBUP+4RO1a4NzgT1fxVv66AuNIlvNVNba/CxfaBBYOzSEb9nWH jRBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WGRil8ABN5YSJ0xudApipfKKb7KRCUPpKNOrW5HAdfg=; b=NH0RjeA23wMYpgngL0p4r4S9UxTBqYm4TydF537zr6lZTJFOD9fSsTTUPXgO7er+30 Ip/xd1hzSeaBldHlvwFAaI/bz2ka438655N/DmwLwh+KhyVHe1HxeNEhkCffeceEiDRh nrHZyG+aGjsSoitzflk578LG5UnAViQTasY0CkWe95sLNr3slRp+lVo5IIefoBDa4NWJ v+zPoyQCvtFAE1CBDfJW9MX3YQo1SuRUT+wk77kDNwTxXKp5nwzfpBYI/OBozz452O38 oyHKgU7E6CKh60MlOSmrRkqGW/fv/gF13dji0MgVWgB8t/dRf2s5EPHPIJ+2Y/20JhSr /7Bw== X-Gm-Message-State: AOAM533tr5060HqnTrEw1Dbj78PYWvP9hQxfg5qzHjS6p7FhUBzx1R0X 9VXe1CyfIewlyGQFFNxY9yjulvnoFuPgtA== X-Google-Smtp-Source: ABdhPJyiiMAWGEi+X+HLvHsp/CCyuBE7HmEgEtUkRL2JCFA/wsIeN3sefT2ovb6eMhblZ1TPtnmblg== X-Received: by 2002:a62:dd56:0:b029:155:8165:c6c2 with SMTP id w83-20020a62dd560000b02901558165c6c2mr22368354pff.3.1604344364658; Mon, 02 Nov 2020 11:12:44 -0800 (PST) Received: from localhost.localdomain (c-71-56-157-77.hsd1.or.comcast.net. [71.56.157.77]) by smtp.gmail.com with ESMTPSA id z10sm14589716pff.218.2020.11.02.11.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 11:12:44 -0800 (PST) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 11/11] tools/smp-tester: Enable hciemu debug Date: Mon, 2 Nov 2020 11:12:32 -0800 Message-Id: <20201102191232.1848737-11-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201102191232.1848737-1-luiz.dentz@gmail.com> References: <20201102191232.1848737-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz This enable hciemu debug when debug is enabled. --- tools/smp-tester.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/smp-tester.c b/tools/smp-tester.c index f64c1ab63..7823b6b17 100644 --- a/tools/smp-tester.c +++ b/tools/smp-tester.c @@ -82,7 +82,7 @@ struct smp_data { bool sc; }; -static void mgmt_debug(const char *str, void *user_data) +static void print_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -187,6 +187,9 @@ static void read_index_list_callback(uint8_t status, uint16_t length, tester_pre_setup_failed(); } + if (tester_use_debug()) + hciemu_set_debug(data->hciemu, print_debug, "hciemu: ", NULL); + tester_print("New hciemu instance created"); } @@ -210,7 +213,7 @@ static void test_pre_setup(const void *test_data) } if (tester_use_debug()) - mgmt_set_debug(data->mgmt, mgmt_debug, "mgmt: ", NULL); + mgmt_set_debug(data->mgmt, print_debug, "mgmt: ", NULL); mgmt_send(data->mgmt, MGMT_OP_READ_INDEX_LIST, MGMT_INDEX_NONE, 0, NULL, read_index_list_callback, NULL, NULL);