Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp307328pxv; Thu, 15 Jul 2021 04:54:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/YoRyZwm6ocRRzEpcqRlAvzpLrebg6jZXdGhYubw/ereyOG4/+hIAZX4G7oacQ5Zw1THV X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr4907612ejc.504.1626350083239; Thu, 15 Jul 2021 04:54:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626350083; cv=none; d=google.com; s=arc-20160816; b=Nzbw/w5jjDpSvBQC8NipWqPBqumeJSRXFcLIcFZ6LHOQnK8GN6kE/oixUitt0ucZ6o HUqcGJ5OOv2vT5JLRGBu6dj5IAlfPfj5mRoBYyC4jNG9sjuEevYIUx0Fys4bwvEhCbm5 ow1RUc5cN6BdRkGxLdAzS/9It39l3w450hPvbsgxMpw/jM3/Z908DO4un4e9N1uw67v8 SlHKqzGjU/+DrkRFi9eH4s5BMBDY7BbwOUI9iWOjdLDxIpBTNfMdXtmG9i16Rhcgu7fR SzpqBPN+yA2XnZPjnWF//uPuPeCJsbwyuQBlsBkoi4tHQ247sFm98CG3xsio9GjM2WU7 zq8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xfqLpBRAhwGbEOemZM2Ho66ytu0wUstTyKrcFOOpnNM=; b=doa7YfauOLocDTt3wb1aD/yGyFLaRt3q72xZqCn4AUhA+6EOVwyU3aspd+Knz0UbTh t1EcinuZXfpeKBqADeLUNPkTqzl5ydZh99NrqF0UDa8Ro8zhNBcLGWNHqtXx23fv/xQw Mg0oy7GR43vovOPpvZl1rU3nq0hIbmnuiCGEjNL++JPqQKYavIWognCn9MAcUnsNeddi udr5f21+NXhRNgRBwnPynmDpKbgbuQFg6iLS/Q7Rt9fgF1ynGOENmFxbVRZPawHCs5we pQNPMSpO5ltYDemTXh4B1GNadyVntCV579eLGosq2lZUcCMqWSK0dO4Y/RVW7y1sCxUk 8xlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hVaJ6Cqe; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lt3si7353003ejb.169.2021.07.15.04.54.18; Thu, 15 Jul 2021 04:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hVaJ6Cqe; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240233AbhGOJx2 (ORCPT + 99 others); Thu, 15 Jul 2021 05:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239035AbhGOJx2 (ORCPT ); Thu, 15 Jul 2021 05:53:28 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C53C06175F for ; Thu, 15 Jul 2021 02:50:35 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id p17so2925717plf.12 for ; Thu, 15 Jul 2021 02:50:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xfqLpBRAhwGbEOemZM2Ho66ytu0wUstTyKrcFOOpnNM=; b=hVaJ6Cqep/KOOUV7tsJQ1TxWVbLu4svtplBp9V8zJzo+p3rF3UO+MSDgPuhh3vEHLL 2o8GKIGFMIZvoGTbVgenii/Pmmn33quXwwhNKVM1iBtjh1zonXdo+kTmJr0QIUjYdQQo oGiTV/s6QL2NXqW3fzLpSTjnpKOxV+YvlPsdg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xfqLpBRAhwGbEOemZM2Ho66ytu0wUstTyKrcFOOpnNM=; b=SfuVKBfKhQOenXDFDjSevAJ5M69VwnfWJ7H4K2hQM6lPZmgnbHzYa752XuzdlWN0Ma usal8algKpCSdV0Sxry9atOxgssE4XvKTaBG2ucu10OUkxUa4MJm3Sv+uWy0SE/o6vqD g26G23C8pyTRijMzdGVTKZUB1+EVrmUQHIVCzmQtl21kQ82chxG22AcKS38b36XDz0SE ZtQiqdJ0DIDC0Eu4OIBbWft5N1iyuTj0KsSipqSPOZBPcAIk3NAoBXYhJ2n5/3EfKCV9 zqoUHtMbAdqwmmk6w0Y9MEK/Bvq3HUwf5ta72wpfWlf1DV9RDSuw4XanohJOBQwrugbF eG2w== X-Gm-Message-State: AOAM533Ytm9hc4LGgs/4dtLH80rIIwmasE9JuTBfcLbzcdsyOIz1PDQt 8aL5zJKrZZosh6sUBqrBD/7JYz3HiBSbqw== X-Received: by 2002:a17:90a:688f:: with SMTP id a15mr3615141pjd.84.1626342634951; Thu, 15 Jul 2021 02:50:34 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:5e6b:4f03:a90f:28af]) by smtp.gmail.com with ESMTPSA id e18sm5892160pfc.85.2021.07.15.02.50.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 02:50:34 -0700 (PDT) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com, pali@kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, josephsih@google.com, Joseph Hwang Subject: [BlueZ PATCH v6 3/3] tools: btmgmt: support bqr experiment feature command Date: Thu, 15 Jul 2021 17:50:18 +0800 Message-Id: <20210715174945.BlueZ.v6.3.I6dc7f0bfe78347213063ff6bd4031daf9b5da43c@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210715174945.BlueZ.v6.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> References: <20210715174945.BlueZ.v6.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the "exp-bqr" command to btmgmt to enable/disable the Bluetooth quality report (BQR). --- Changes in v6: - Remove the patch that adds btd_adapter_update_kernel_quality_report() since no upstream code uses it per the previous review comment. - Add this new patch to support the "exp-bqr" command in btmgmt to enable/disable the Bluetooth quality report (BQR). This support is to be consistent with other experimental features. - Note that the bqr experimental feature is designed in the way that it can be enabled/disabled at run time instead of at bluez daemon launch time. And the default is to disable it in order to avoid the overhead on the controller. Hence, it is not enabled through btd_opts.experimental like what rpa_resolution_func() does. tools/btmgmt.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/tools/btmgmt.c b/tools/btmgmt.c index a6ac026dc..997af70bf 100644 --- a/tools/btmgmt.c +++ b/tools/btmgmt.c @@ -1842,6 +1842,52 @@ static void cmd_exp_privacy(int argc, char **argv) } } +static void exp_bqr_rsp(uint8_t status, uint16_t len, const void *param, + void *user_data) +{ + if (status != 0) + error("Set BQR feature failed with status 0x%02x (%s)", + status, mgmt_errstr(status)); + else + print("BQR feature successfully set"); + + bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + +static void cmd_exp_bqr(int argc, char **argv) +{ + /* 330859bc-7506-492d-9370-9a6f0614037f */ + static const uint8_t uuid[16] = { + 0x7f, 0x03, 0x14, 0x06, 0x6f, 0x9a, 0x70, 0x93, + 0x2d, 0x49, 0x06, 0x75, 0xbc, 0x59, 0x08, 0x33, + }; + struct mgmt_cp_set_exp_feature cp; + uint8_t val; + + if (mgmt_index == MGMT_INDEX_NONE) { + error("BQR feature requires a valid controller index"); + return; + } + + if (parse_setting(argc, argv, &val) == false) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + if (val != 0 && val != 1) { + error("Invalid value %u", val); + return; + } + + memset(&cp, 0, sizeof(cp)); + memcpy(cp.uuid, uuid, 16); + cp.action = val; + + if (mgmt_send(mgmt, MGMT_OP_SET_EXP_FEATURE, mgmt_index, + sizeof(cp), &cp, exp_bqr_rsp, NULL, NULL) == 0) { + error("Unable to send BQR feature cmd"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } +} + static void print_mgmt_tlv(void *data, void *user_data) { const struct mgmt_tlv *entry = data; @@ -5547,6 +5593,8 @@ static const struct bt_shell_menu main_menu = { cmd_exp_debug, "Set debug feature" }, { "exp-privacy", "", cmd_exp_privacy, "Set LL privacy feature" }, + { "exp-bqr", "", cmd_exp_bqr, + "Set bluetooth quality report feature" }, { "read-sysconfig", NULL, cmd_read_sysconfig, "Read System Configuration" }, { "set-sysconfig", "<-v|-h> [options...]", -- 2.32.0.93.g670b81a890-goog