Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1222461pxj; Fri, 18 Jun 2021 02:17:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCmegTu3qtIAifdQG7MQDoBBeYlvaKQFXkwCi/iU0PM74IVTSgcP++8+unN8GPCKa/J5nu X-Received: by 2002:a05:6402:177a:: with SMTP id da26mr3691408edb.40.1624007871081; Fri, 18 Jun 2021 02:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624007871; cv=none; d=google.com; s=arc-20160816; b=QM5A1d9gs8EaDAOBwim16rVMMbgvU3nuqY1IvTFpf1cafFX5U7sfgCUUT7Xl3FZmnK sFNPLqoabJtGxrR4BwAHeHfYq3y5D6s9WR6KEsJmFz/fGdddlprQoP1oG7v2j3+t5dmE bMNNZ97ULPjxDyiz04kwRIMND6lF/OPHhtDhD1ydEpMax+SwNsJqscSkRLUPhIyjaia6 foIk7JpuVO+ZvzFbeEuuxi9k10fPV80EkaHPc/36nP5MvvDfSVzBcw8jjoWCnLCvWTpp C/F8/fFiPguP8YfVXnVJHLSOhn5tSA0JVxAwP9Li3PKnhsQd/GCEAEsw8FzebJ37CH09 XBSA== 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=pPqziRSzqZjXI99FuqjKJHhPX4q0+WvBG0td3HE735A=; b=SwSuSzbeu3Yb2+uwjlUzQ90GeWopMPoE6Ybf/ZtLZ98wzhnjm/h9LC/I/b60wgSKod XZ12K/9a+GklfgV4GK3myFPGEzUmjAvFtTCd9Q+Tj6KhpkWSEDrWjdAjOKeA9Uoc/99e B5H3Ow+PE+JutUZqsvFIhVooPiuqu2JhfnH0uY0gRTJZk8fAnuSNIEExYMYsvwDJDbtE e7zLdPAvJKBFuiuuLp05Umfvlte2a3m9ICnRR+h054HWDyAI9cYRl1up29Q8MX+pYezM i2i2qUtDQiW8EudU7IpMpacTF83zvHA+vok/adWNWqN6Mvmhb7w59KuMw8OGiRv65H6M +GJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=fVEP1+MD; 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 y13si1885818ejk.111.2021.06.18.02.17.12; Fri, 18 Jun 2021 02:17:51 -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=fVEP1+MD; 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 S232473AbhFRH7q (ORCPT + 99 others); Fri, 18 Jun 2021 03:59:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbhFRH7o (ORCPT ); Fri, 18 Jun 2021 03:59:44 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86001C06175F for ; Fri, 18 Jun 2021 00:57:33 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id k15so1902162pfp.6 for ; Fri, 18 Jun 2021 00:57:33 -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=pPqziRSzqZjXI99FuqjKJHhPX4q0+WvBG0td3HE735A=; b=fVEP1+MDSQ62AzyHwt7jTxL/RQJ1zACl/eBl5Ni+/9zt+dBN+XRgv/j4zKKMHtZuLp 7t5o+Fr4j39JwIgBQq/dCDwuO/jUKWeIuRlOEZNpaTmpneDA0BJQ/paZ4h7iw+LZ80FU DmT9fMnBVezxQPwSLoW/AG3d+TcWje3Sd3PZg= 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=pPqziRSzqZjXI99FuqjKJHhPX4q0+WvBG0td3HE735A=; b=VxnZGJTXALt98iId/W9PRhgBAOyFudARsnyn7TY7Wc6SsE2DiSwXKI+VEDKttNgrFS zC5bT9z17s/hYREm7ucI2SCPCmGT59TVkPFL8kTyxLFDqaNaOZ/e8Bbu8rl4ECwSfAD5 N9aXNA4wYnbPr6KUpVuDJvV+SHtZYRpLpeNS3PfumrKkEwEemW0dGqh9W5TeSuQzdUNx +cmAF3k21dPfiOOZxCQpj1E3/TkYuVEyTU0MiXB0GRjbjqpKTQDesgk2k/FZdoZ+7AL6 l/SHkdPkd8ydeASiqc4X/lufq0BR3mJdcO5J1EHWQXrIpKDVP5+c/f7EC4a2lwlnH6Nv bGsA== X-Gm-Message-State: AOAM530bEyDrs344udBCHYShZcqBhkMOHDkvEBvNB82AYgGCH6OHSZRU E5BW6QosB7r/7Cg4F59Qu0wIwnfG1Uzmhg== X-Received: by 2002:a62:f20a:0:b029:300:43ed:198d with SMTP id m10-20020a62f20a0000b029030043ed198dmr1295807pfh.55.1624003052734; Fri, 18 Jun 2021 00:57:32 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:6cbb:95eb:e2ae:8479]) by smtp.gmail.com with ESMTPSA id z185sm7879219pgb.4.2021.06.18.00.57.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 00:57:32 -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: [PATCH v1 3/3] adapter: set quality report feature Date: Fri, 18 Jun 2021 15:57:17 +0800 Message-Id: <20210618155610.v1.3.I5b72c623fb8b002a5e1f000149b362af3c01ab98@changeid> X-Mailer: git-send-email 2.32.0.288.g62a8d224e6-goog In-Reply-To: <20210618155610.v1.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> References: <20210618155610.v1.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 Signed-off-by: Joseph Hwang --- 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