Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3367373pxv; Mon, 28 Jun 2021 03:04:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8y+9Rfmk78KSZhsiw/276htuf0uaEUMenkf+7gn/6evnj6CerbzZXYZzG1Jo9lSzu47Ha X-Received: by 2002:a17:907:3ea5:: with SMTP id hs37mr23297414ejc.473.1624874683955; Mon, 28 Jun 2021 03:04:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624874683; cv=none; d=google.com; s=arc-20160816; b=rglE5u2LCN2iHtU5JGyFiAfVpjdFgiOy0sWDz+vmNjRGAeZnOQAyhW+L6pdHGWxpXH nvMI7CLzf4W14rlnxPJSztMqDjyx4fIMboHkWJT4+BR/pIrhYWFwrgRvFgiPo/v9k27i RNVC9RUobUtxdTrD3ci0M6UqHvRxACbp73fcir9JwLf2svWuf7LmQbMN2/1or4zabCga x4aiF9bK0XJffXjcTQgYX1fUJTCwPAvnFfwM5ZtkHmIOZ+m4zT6mgv8tx04tePtlSnbG XCOwNQyQfgYaCRkigpEgmEH0qi88ZtghAq/OiZp9K/Pm2sP8o0IcmXMg8g7JxV4bAP72 S9VQ== 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=+Pol7EU6cLeB9bzs3xLMxd7uFMdBT25dp4ht2BBEEjg=; b=DivVa95ghYRZSWGMRYlElPtVdSU/3M3HpvQtgROni1u2iCrTsO7dkHFALV+LIW1oYE qUGmgIUlgIkywtrVIoDVVM9Mr+RIm9QF0O1bEdSixF52dqNUpZnvhY28JYYFgb0IuZlW 3C3DurgESpLdV3VTM7DwIwj/ovgjXCfqSCjDl3UBHGw+8L0fWu7wsfis0MwqfhSLulnf EDsVRfASVh/Z5TOysT+7kwCZcuexl3TFQZoJR7ORYaBM/TtP0hApOjYDGPdwlDfRBe60 crfWp1DDkT/jbTnIpRsJxYSVLk9c9cODs1rlXPyGgVO3f+KYXqWvajh4P0I1MFNFY6z6 6Nqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EasfcQ1k; 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 1si13769643ejm.532.2021.06.28.03.04.19; Mon, 28 Jun 2021 03:04: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=EasfcQ1k; 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 S232590AbhF1KCw (ORCPT + 99 others); Mon, 28 Jun 2021 06:02:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230256AbhF1KCw (ORCPT ); Mon, 28 Jun 2021 06:02:52 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55F45C061574 for ; Mon, 28 Jun 2021 03:00:27 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id mn20-20020a17090b1894b02901707fc074e8so1325869pjb.0 for ; Mon, 28 Jun 2021 03:00:27 -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=+Pol7EU6cLeB9bzs3xLMxd7uFMdBT25dp4ht2BBEEjg=; b=EasfcQ1k7npcludDjnMCNv539VbR6VT+SDxrwbLD1GW0IAZOHmo1Tqy6ZIR1IdeO6p xcDNLLLQ1wDz2DzIf04vuVHNG6bjEUmDIVhStNZ6M5/Dpnun/n2X/ayKYNYpYGfrjEO/ N5Dr/Wss7F9Rzls0zLx1EUOs7w8/Hg7j4jEDE= 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=+Pol7EU6cLeB9bzs3xLMxd7uFMdBT25dp4ht2BBEEjg=; b=kT0L2Mqpacf5XkdNE6BhBky7eWruLLJ8w8HMqe42Y86b8SlvkRkCHtU7AteGwjXAS2 ARhlox+StxApiL40+Fri4rcCPBgdPlBOu2bhKxOkHMC/W3eVXfKrpu1PnKVwQvmKzzly uAEBGZq8p7gx/ygm/l9J55yIa1E8dUZcFasDzWACK2sbLzZjO64f7/Bszq5CDqf3Psyt UEOX59/3uqcSMuPCqUpHgDhvljco4o1AghkQhaXxmliaFZiaFTbVJS+7Eh9Q+bml77W7 VpYP/22lJM04vqlapn3rlwizj666DzVVjrQelOLjTBefH+9DqvdPI4puMvH47DtLdejA RBjw== X-Gm-Message-State: AOAM5330Ydyb84JHPQ5r6mnayeLmGYQSH1AijmcsGuN5BeJ7RSQYaDBL /y7LDUgrtg0ZXIDB2S/9DfELTdKZowApQA== X-Received: by 2002:a17:90b:1c06:: with SMTP id oc6mr25864671pjb.112.1624874426201; Mon, 28 Jun 2021 03:00:26 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:d73e:91da:d7c7:57a]) by smtp.gmail.com with ESMTPSA id y80sm14003834pfb.204.2021.06.28.03.00.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 03:00:25 -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 , Miao-chen Chou Subject: [BlueZ PATCH v4 3/3] adapter: set quality report feature Date: Mon, 28 Jun 2021 18:00:16 +0800 Message-Id: <20210628175942.BlueZ.v4.3.I5b72c623fb8b002a5e1f000149b362af3c01ab98@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210628175942.BlueZ.v4.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> References: <20210628175942.BlueZ.v4.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.93.g670b81a890-goog