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: 314368 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: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: 314367 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: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: 314366 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: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: 314365 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: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: 314364 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: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: 314363 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);