Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4188774pxv; Tue, 29 Jun 2021 00:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPlmS4fbH4xOOjRIFPKezQXUcFwc38Igmi7fpko/x8Cx7MlN3w3Z9GKPeajKsfFXTAm20f X-Received: by 2002:a17:906:c10f:: with SMTP id do15mr25610561ejc.475.1624952996223; Tue, 29 Jun 2021 00:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624952996; cv=none; d=google.com; s=arc-20160816; b=Ywv0EH3HXkS7dwEkDKgmw05G/vCTz1SbOS/hNnNPGyN53W3Wfl0CTksTNcKGyswlXx Y88Fury7cbbPucce/XNI8/M3hvoLBGU2oFRqlY50ENL+ebMBvqO24+Lzzfe2i34dPWDg mp+gEw8A4Qr7GMRfkhJ9eVmW3PsSNhBSLPN4KcKM5gWmIEhKF9kA+cfc9quBO7fqBcVF kpEmo86JIp9EeQw4wSHv/QtqM+h0seAh4VJnc8yZGsdvClKutmOHglxGQLQry4TnWG3c VksrSOOKgNJbjwlrpWyJZ9t/uEMLOM6Rn0AtiwVz7Jy9pL1U06WxwN6WkSZ4ZGPx6hv+ 9GfA== 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=agwyoblejgRhWgMa2WcDl518gjO01szA4kHdLdnYK/NC+/nG/dSMDYs4xn7e8mpMdR s6xD/GseUvVT/ToH68OPg5PJjuEqriMRjWzBo6Ce2NKyYmzi+zlzgKEnHYife0thM1k2 SRd9yE/TwDTooJx8Kg869Cfk8SH01zvHokiUO39QOz3C7taFNoXfqpy1rlJQRwq+RpGA sMgmFihQB+KtjYiG0nKyfTysTFrkQ5mXFVAaDB6UPv+fRR6VbcohrracEN2dqtWfbKrn 7HUGfLzo4lwoYxYtCDq3vRewLEL0eW+66HcwqcphNTNypL3eaImrg+dJtk4BbkNrj9P2 23Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V5MNpof1; 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 g5si17434988eds.316.2021.06.29.00.49.19; Tue, 29 Jun 2021 00:49:56 -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=V5MNpof1; 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 S232285AbhF2HuI (ORCPT + 99 others); Tue, 29 Jun 2021 03:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbhF2HuI (ORCPT ); Tue, 29 Jun 2021 03:50:08 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D3E7C061574 for ; Tue, 29 Jun 2021 00:47:41 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id d12so17728572pgd.9 for ; Tue, 29 Jun 2021 00:47:41 -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=V5MNpof1PuRabfyaJvj7DmJL47DUKQK52lCaUhTcVjtKbsqwwETxYrpMQHRCMo8fNA AYSrye4KjNJm1Q3TvvW8W4AQSEa+9sUXpY0e3q5QetIB1MGwEk2SVV3y86WrreikWkty C5tcgYhf//EWCf7vLn+L9qaq8BFekOGL1ADLg= 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=eDbFBoWRMU92HVnKiu5p3ZGmyn09qRqTtq4wkwkmmrGjTBS4w1ObM7Ks0usugyge2V X7H+b4t5VA+dEQ7BXjP+/1y+f5gYbHnYQ25zHwRCOaHoYKlNh23zq/I0kyB1e4s1RQW0 cc4uMi/vzacOMw4qYR8Xk57QsBHFKVqIVu69Td0zZz7vpEvxE+COa3epR1/T0Ui6vPff YCysuYh0HY1Cj1yMnoerFwrNDUgSfLrkw+2DHYL7aSpTPR5sUUs/6GsZPUyEDwRm64lz w87VDVaR7gSswB5D+VhBL4RDUdjqOqqPEya4TjsmBoPN0cS0NFTx32CplHElFt1C3nLU J/mw== X-Gm-Message-State: AOAM533qa0P8w9wA7uga2yDmyM44JqfJu6j739v5iyIHHvlu9FyQPSBV 8ChaM0ERya3kAQzPnPHoUvCcCh0fZ6IkQA== X-Received: by 2002:a62:8647:0:b029:302:4642:ae52 with SMTP id x68-20020a6286470000b02903024642ae52mr28776168pfd.7.1624952860375; Tue, 29 Jun 2021 00:47:40 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:b852:1fca:2281:244f]) by smtp.gmail.com with ESMTPSA id s7sm17454289pjr.11.2021.06.29.00.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 00:47:40 -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 v5 3/3] adapter: set quality report feature Date: Tue, 29 Jun 2021 15:47:24 +0800 Message-Id: <20210629154652.BlueZ.v5.3.I5b72c623fb8b002a5e1f000149b362af3c01ab98@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210629154652.BlueZ.v5.1.I832f2d744fe2cff0d9749e24c9ec27071fa0b4ed@changeid> References: <20210629154652.BlueZ.v5.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