Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp237908pxb; Tue, 15 Feb 2022 12:10:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHbjyQREhmPzSme95GmSJdeYs6AvbAtSFX7QmJgbomsG0QGygriY/FNRSohQTIjFkDMrHk X-Received: by 2002:a17:90b:3a85:b0:1b9:e751:2335 with SMTP id om5-20020a17090b3a8500b001b9e7512335mr6283674pjb.43.1644955845786; Tue, 15 Feb 2022 12:10:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644955845; cv=none; d=google.com; s=arc-20160816; b=ipOtHWExNVC2lCN+gjehkru3acXFy4jikSjHRNkEpjhBYoJPT/ifaMwAj51eDrHZrc Ga3G+dQkhlweFlQSe7QgIUtb7wYALT0MX5FVxoV/uw7J+lYwbv/jkW7txIoFvx/u+roa pOccSkp5NQPbj2I1yhf3MT4KfTA1stSrGVeqXx31yIxA0GoxnQ30IImc8y9uBLvWRnH2 xNUQ0AiHKWlRAzdqIeSq6GOI4srXtIoLIDFZ1BYE1gaQwXVBIY1+l/EGI1xDHNc/6X6i J7ENyZAtkqwLTVk7DHzgzxXssVJiwlRVKKmZTQAv8/K3K4eN4f5Zo9yXfLQRFp9Fu38W FgoQ== 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=J48r90Vm72k/4dumF504U76cCOox1c/Fx02dPurFxlQ=; b=wqXYJx+3Erl7sq7l6D1cakgpqs69+dvaQcNm54svdcXavYV67sNwIpOb8ZxBvw/yI6 8PCHHCy+pqXIWTmU7uwmsY5xcNAs0kCMXxo/aMT5Paplvgn9KWlX+LLO/l24gXxZLhUV 0tk/5SOAbY09/5xmB9ls/sZaBl2gLJj+wpr5ZdtfrokU5FTk+/0Tlx4Icz2u0GXZbndw sj3/6tmETXr6UMd+gV83B85Bp3q3u3KUE9tBbu5sY5aYffFdtmlLCvDmXY4tOJnZu3fd wDeUHu52uawJ/R+nGK9lIM6ORhv3G69Mb8/SloMZiGJumB0sPRBnUl9B6dRDGqobv4oa zwdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hk3IYT1a; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bh9si3910658pgb.80.2022.02.15.12.10.30; Tue, 15 Feb 2022 12:10:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hk3IYT1a; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S238317AbiBONhH (ORCPT + 99 others); Tue, 15 Feb 2022 08:37:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238283AbiBONhG (ORCPT ); Tue, 15 Feb 2022 08:37:06 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB9265179 for ; Tue, 15 Feb 2022 05:36:56 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id y5so34921419pfe.4 for ; Tue, 15 Feb 2022 05:36:56 -0800 (PST) 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=J48r90Vm72k/4dumF504U76cCOox1c/Fx02dPurFxlQ=; b=hk3IYT1a+N+/pTexWbG5uA+YAEZ7gIi0/BTXtT3jNwBsRImUoaVPboET3D253+b6ij SgTT/A5csABOkb2I9r9yDdplvMTsawQBMOEPhk5F5He27eUjJGwhbzEkH2+os7dVPf/B V+wecdjg5EVbOWrodCINhRG5sl2Mnus+dibdw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J48r90Vm72k/4dumF504U76cCOox1c/Fx02dPurFxlQ=; b=feEWmVTn/dthvMRlaQG4Ey8/RSQqJSQJWBU6Xt9jaJ6b5riJqzJvbb++ggby4HOIGI fkQ5zcXNifNdZuqyOtFaLDt4zGP+J6NkeBQGTGPkukA96GrQJWyNd6wIzv9bym9ZI3Sn MTjyLy4jOBC1pEt9WlO1xsBQIblRFOPu6t2I1WoxWDnyQgjsF2teft6tiIfYnnBWLpOp 1HQYl3kyhy0QOCSlBTlOOU8zt0QrYrXVo3Qq3pD3kntGK+F9398aDSWwKvL7fTotj2Gt Be3/S/JvUf02YVbCutD7YS9+V9glhKywfMEQBjUcn/c+UrOyfcyF230o3gK8PTDct4af /LsQ== X-Gm-Message-State: AOAM530rd9bzSns9LaaSPl+B+/BEBwfrgD8UnAsP1U0Czel6WpLrNLge sveHrj/FZQLYfEND1zyGZGkqcuGjoitixw== X-Received: by 2002:a65:42c4:: with SMTP id l4mr3473181pgp.505.1644932215899; Tue, 15 Feb 2022 05:36:55 -0800 (PST) Received: from localhost (208.158.221.35.bc.googleusercontent.com. [35.221.158.208]) by smtp.gmail.com with UTF8SMTPSA id k21sm40633811pff.33.2022.02.15.05.36.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Feb 2022 05:36:55 -0800 (PST) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com, pali@kernel.org Cc: josephsih@google.com, chromeos-bluetooth-upstreaming@chromium.org, Joseph Hwang Subject: [BlueZ PATCH v4 6/8] tools/btmgmt: fix quality report command Date: Tue, 15 Feb 2022 21:36:34 +0800 Message-Id: <20220215133636.2827039-4-josephsih@chromium.org> X-Mailer: git-send-email 2.35.1.265.g69c8d7142f-goog In-Reply-To: <20220215133636.2827039-1-josephsih@chromium.org> References: <20220215133636.2827039-1-josephsih@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org The set quality report feature becomes a mgmt command and is not included in the experimental features any more. Signed-off-by: Joseph Hwang --- Changes in v4: - Add "quality-report" in settings_str. - Print current_settings in quality_rsp. Changes in v3: - This is a new patch that fixes the quality on/off command in btmgmt. tools/btmgmt.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tools/btmgmt.c b/tools/btmgmt.c index 42ef9acef..14efe37db 100644 --- a/tools/btmgmt.c +++ b/tools/btmgmt.c @@ -353,6 +353,7 @@ static const char *settings_str[] = { "static-addr", "phy-configuration", "wide-band-speech", + "quality-report", }; static const char *settings2str(uint32_t settings) @@ -1842,26 +1843,28 @@ static void cmd_exp_privacy(int argc, char **argv) } } -static void exp_quality_rsp(uint8_t status, uint16_t len, const void *param, +static void quality_rsp(uint8_t status, uint16_t len, const void *param, void *user_data) { - if (status != 0) + const struct mgmt_rp_set_quality_report *rp = param; + uint32_t current_settings; + + if (status != 0) { error("Set Quality Report feature failed: 0x%02x (%s)", status, mgmt_errstr(status)); - else - print("Quality Report feature successfully set"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + current_settings = le32_to_cpu(rp->current_settings); + print("Quality Report feature successfully set"); + print("\tcurrent settings: %s", settings2str(current_settings)); bt_shell_noninteractive_quit(EXIT_SUCCESS); } static void cmd_exp_quality(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; + struct mgmt_cp_set_quality_report cp; uint8_t val; if (mgmt_index == MGMT_INDEX_NONE) { @@ -1878,11 +1881,10 @@ static void cmd_exp_quality(int argc, char **argv) } 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_quality_rsp, NULL, NULL) == 0) { + if (mgmt_send(mgmt, MGMT_OP_SET_QUALITY_REPORT, mgmt_index, + sizeof(cp), &cp, quality_rsp, NULL, NULL) == 0) { error("Unable to send quality report feature cmd"); return bt_shell_noninteractive_quit(EXIT_FAILURE); } @@ -5636,10 +5638,10 @@ static const struct bt_shell_menu main_menu = { cmd_exp_debug, "Set debug feature" }, { "exp-privacy", "", cmd_exp_privacy, "Set LL privacy feature" }, - { "exp-quality", "", cmd_exp_quality, - "Set bluetooth quality report feature" }, { "exp-offload", "", cmd_exp_offload_codecs, "Toggle codec support" }, + { "quality", "", + cmd_exp_quality, "Set bluetooth quality report feature" }, { "read-sysconfig", NULL, cmd_read_sysconfig, "Read System Configuration" }, { "set-sysconfig", "<-v|-h> [options...]", -- 2.35.1.265.g69c8d7142f-goog