Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3643049pxj; Mon, 21 Jun 2021 03:26:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJPBE0LTu6ikROaozvYEOsyvHLilhDInHRtA6hDWSJa0HxisLqX+kHnKOy7KC8p4s6wFRc X-Received: by 2002:a17:907:98f6:: with SMTP id ke22mr21973426ejc.533.1624271177867; Mon, 21 Jun 2021 03:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624271177; cv=none; d=google.com; s=arc-20160816; b=UeHOBKytoMLSAmNJvINns8Xo4bW576qgv3eFcE63N4CzSK/PrbTJIEbLlOOdp1SusG sCl5HooYlL/kYDUXgXGPzt2wnpGH1vWQ+782CqDuBCO5z8ge42CX2YRos2PD6pPcZV/z PEF8G78X2yF5paJl4z7ScAabjq9/t9FO/BtEtWD5JqWFKFhrDs+MkDg+bLheA/TK58x6 ulnMToU2Wk20z96yaIHsNs1d0T5C75tVSHh/6dkZZY8dbdAxAjEIVp7dlWdvMPiySfem CfNYxIE2pryrQPiQuUB9uVts0ERdQzO4ow5dTaQKI9E2Chkti1iB2iLk5x/Yz9Lmx2+8 XxqQ== 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=yfZszNu/qpVMlW2+e/ON9/cSXeVNWmCiXwm+WJdOfww=; b=rs14huGHrBfV5ahNnEmgECYpqZHJFNDkLr9Q5XJ9GsuxJjopVMT6p/cT/ihSAOVrnC 2s1nKUHWIi+a65eACx0U+IvuFjqaAFMlxYwF7lD5Doll720HwGIbXzOWhTsh3b+2acA6 sdVelEmVKy3weOBJCt4r8ZgxT+Nv1DhInNER3AogscVVfq7mDdOtLG9DmRixNf7ZP0G0 CfflMYli3E16c3lzZFB6GWkWOoBYvNvhK0V0GVaMBwUd4r/tGzArF9yfZUfQdb5C63IH N2kFfWH0hzmeUL9lXCEyAMMPVGYa4bhgxdxdC0rnMYYk6PnEN6i0Yyov7QVQNXHEQflr 6OSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BT6wXhjI; 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 z19si16970007edq.486.2021.06.21.03.25.35; Mon, 21 Jun 2021 03:26:17 -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=BT6wXhjI; 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 S230327AbhFUKZ5 (ORCPT + 99 others); Mon, 21 Jun 2021 06:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbhFUKZw (ORCPT ); Mon, 21 Jun 2021 06:25:52 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB08CC0617A8 for ; Mon, 21 Jun 2021 03:23:35 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id m17so5108169plx.7 for ; Mon, 21 Jun 2021 03:23: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=yfZszNu/qpVMlW2+e/ON9/cSXeVNWmCiXwm+WJdOfww=; b=BT6wXhjIXeaw3RAoW0VU3OorirrBKsxCj1aS/BDFFlxcx8lDhaQgnM6Sn8B87Jq95b IYmCP6WQs3ZCYL647151LGLodEK53fbydTYMMD9WDVJU+qcqQWcCLnjiL374aGiu4FG3 zffw4emoiBIfraZYLh2t7znqslNW7mXvSs2Tk= 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=yfZszNu/qpVMlW2+e/ON9/cSXeVNWmCiXwm+WJdOfww=; b=EKraz9TVrdoYH9FyJCtmwBSJQXxoFRgFP0BzlAl4uBcqJNqGmu/uFjUO2jw+lHwCmP /qoh9opf2PNeu/uOGGs8Dyz4mpO+sCVrGLEOtrbfyZjvpO4A+rqlpL+B6Fjj5oXc0q1/ esROwWmRV8El2OegSxcMgpS1ktYhwr8KEo/tYiCfy3U11vU3wo8HLQ2iRBtBcZoVEGPP U6fnqriPXWSlLk1bt6EqzrommcgwQkJWfVoX5KQyGcpz4QvoRH1mqLBSdiVwpEdMjVLB Dv69wUm1ZebSPx8cSUGSqaTV67nyyCYapdIRMYeL/67Xfk5cTkzZSKyx12wWQwTaPQiu 0Djg== X-Gm-Message-State: AOAM530mDJQVZERI4jX8a7UgBUXSwKIy6OaUqX1w7NqhIDvarz5Wcfzm Wl5c1g0KmyhLlLHwHmBdRywAqjnHnHoz3A== X-Received: by 2002:a17:90a:46c8:: with SMTP id x8mr38306889pjg.216.1624271015005; Mon, 21 Jun 2021 03:23:35 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:1c86:d28:c4ad:7497]) by smtp.gmail.com with ESMTPSA id j10sm15375153pjb.36.2021.06.21.03.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Jun 2021 03:23:34 -0700 (PDT) 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 , Miao-chen Chou Subject: [BlueZ PATCH v2 3/3] adapter: set quality report feature Date: Mon, 21 Jun 2021 18:23:01 +0800 Message-Id: <20210621182149.BlueZ.v2.3.I5b72c623fb8b002a5e1f000149b362af3c01ab98@changeid> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog In-Reply-To: <20210621182149.BlueZ.v2.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> References: <20210621182149.BlueZ.v2.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 function to enable/disable the quality report experimental feature in the controller through MGMT_OP_SET_EXP_FEATURE. A user space process can enable/disable the quality report feature by sending a property changed signal to the bluetoothd. The bluetoothd can set up the signal handlers to handle the signal in a file under plugins/ to call this function. Note that the bluetoothd calls the experimental feature only when the quality_report_supported flag is true. Reviewed-by: Miao-chen Chou --- (no changes since v1) src/adapter.c | 36 ++++++++++++++++++++++++++++++++++++ src/adapter.h | 2 ++ 2 files changed, 38 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index e2873de46..829d9806b 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -9332,6 +9332,42 @@ static const struct exp_feat { EXP_FEAT(rpa_resolution_uuid, rpa_resolution_func), }; +/* A user space process can enable/disable the quality report feature + * by sending a property changed signal to the bluetoothd. The bluetoothd + * can set up the signal handlers in a file under plugins/ to call + * this function. + */ +void btd_adapter_update_kernel_quality_report(uint8_t action) +{ + struct mgmt_cp_set_exp_feature cp; + struct btd_adapter *adapter; + + adapter = btd_adapter_get_default(); + if (!adapter) { + info("No default adapter. Skip enabling quality report."); + return; + } + + if (!adapter->quality_report_supported) { + info("quality report feature not supported."); + return; + } + + memset(&cp, 0, sizeof(cp)); + memcpy(cp.uuid, quality_report_uuid, 16); + + cp.action = action; + if (cp.action > 1) { + error("Unexpected quality report action %u", cp.action); + return; + } + + mgmt_send(adapter->mgmt, MGMT_OP_SET_EXP_FEATURE, adapter->dev_id, + sizeof(cp), &cp, NULL, NULL, NULL); + info("update kernel quality report default adapter %d enable %d", + adapter->dev_id, cp.action); +} + static void read_exp_features_complete(uint8_t status, uint16_t length, const void *param, void *user_data) { diff --git a/src/adapter.h b/src/adapter.h index 60b5e3bcc..001f784e4 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -240,3 +240,5 @@ enum kernel_features { }; bool btd_has_kernel_features(uint32_t feature); + +void btd_adapter_update_kernel_quality_report(uint8_t action); -- 2.32.0.288.g62a8d224e6-goog