Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp878542ybt; Fri, 26 Jun 2020 13:53:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz6LWb0WQ+34YbhymO6+JzI9o7NbvQGDx0T3gijtdZqAXElppQwDRFdknU3NeS7yh+qyAq X-Received: by 2002:a17:906:17c8:: with SMTP id u8mr4314182eje.129.1593204836685; Fri, 26 Jun 2020 13:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593204836; cv=none; d=google.com; s=arc-20160816; b=XGlFB9fFGWapB0OrlDDZkQWoqjUPRRHmmvG9iANLZ4m1QI/9X5rQMOu7KMSmUeZ+Rt ik4F9lxD0pa1vfQJ1X0GsLHAQJiTztCPEhfQCKYqKoj0qnUzxww4W+RH/fxPPCyFLL81 UeKk3lG9eNB5oT1biIFPwlHCzoVZ5aUoBEgOeZxYy7t3FKXcuoxDlHIMhGfwsvFm7jP0 W/NSRH+R5a7XA5RCZK6chU8QunyS6N63NcrBGZaHzGsf11YKR3fuF9DRD1BrHzEIBdyZ 3f2YJEUe3VULX9EL0R4DlGKxYtRZjVUzwBecuA/980U3jq1+9/Q/0m4YuqjFafaiArZP Cm9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=F28DKKzLmbR7W73UOUFS8FIZyK/mYYGjEUVIdBnpyC8=; b=gsDmdCdq7X9fdgMm3f/r/ICtixjG3QaccxCw/1fal0G9JfJtuFu4V2EFLbWDAdvr/2 udPBhee2wgUQnMD7AzGhu7i+Qf8gLcNYU10WVO4pgPlb16JnJ9Y/1G74z21tm9mBiXHU TsSW6fzKkL2T83pqjebygHKmDrrs1pLH3vhe/vLZEhth77NlvVWqBEiTFzwsAz27kSmO 91PwySI2MuUF6BxhXYwZmIGGSqKm4ikFPSkWFuoyBM7NEntsmOMioybbFMtpzpmvKURi XZWPhFEzOGlWcjH8stm6O9wlkWeIFB+9kp1sVn1w5yeUEsnagGW6MQ4HVbk6MOCybOGj bPOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=C+Q859+l; 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 12si17390332edv.523.2020.06.26.13.53.14; Fri, 26 Jun 2020 13:53: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=C+Q859+l; 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 S1725821AbgFZUxM (ORCPT + 99 others); Fri, 26 Jun 2020 16:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725803AbgFZUxM (ORCPT ); Fri, 26 Jun 2020 16:53:12 -0400 Received: from mail-vs1-xe41.google.com (mail-vs1-xe41.google.com [IPv6:2607:f8b0:4864:20::e41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBB19C03E979 for ; Fri, 26 Jun 2020 13:53:11 -0700 (PDT) Received: by mail-vs1-xe41.google.com with SMTP id v1so6179160vsb.10 for ; Fri, 26 Jun 2020 13:53:11 -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:mime-version :content-transfer-encoding; bh=F28DKKzLmbR7W73UOUFS8FIZyK/mYYGjEUVIdBnpyC8=; b=C+Q859+lsX0buzzJl3WTARLJc6834nPZxLq4uL9mnv7kXzJsp/jEo+kjLiXxYuGg5a wRxn82t0r4YmP9iPQFPbwj0L3JKlkKflBxFSRqdV0QfQINizYTKQUsxtrauF4GUmFSWM k1LLW4UfmiMGHp1w5GiVJQa4F1CfQ659GcEpI= 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:mime-version :content-transfer-encoding; bh=F28DKKzLmbR7W73UOUFS8FIZyK/mYYGjEUVIdBnpyC8=; b=X8NK1KSwPgIp26AmwWLOavjwJJ81Xu25C49pS8MI9AWr+fGC0GAfxdHypIobI3ivT4 PsrAmDEnl/BSd1CjJxI2Q9WMI7vmPhQbwEKQkQSGNO/t//wcvUioqqFdaDnftU04+WeW brheEeeWVh6BmYFAmO3f5Mkdp10w/LoihahJloFwERVslfO5G56PL/dTxPW9GOHeWhkK 17qvr5omPuxHTAF28xF2SEEBfNl3s8Kp0laBS7Ui2f/lJSdiiLMhUseq9MTfD7/BTNvv 4XcHVzssn2FxvXbrFN2ldNO76fw3oW9rkhW9xNQ3A2D1xePfgIQD45zNZNwHRueZWq+K mPxw== X-Gm-Message-State: AOAM530dndYiHHJx0B3P92ynMcZmg4AHdZmwx0Xo6ogQQWPZ4hvGdXNP Kr600F9gi51RG111mZqc1Lh07DLySxM= X-Received: by 2002:a67:eaca:: with SMTP id s10mr3984018vso.58.1593204790787; Fri, 26 Jun 2020 13:53:10 -0700 (PDT) Received: from alain.c.googlers.com.com (252.177.243.35.bc.googleusercontent.com. [35.243.177.252]) by smtp.gmail.com with ESMTPSA id i203sm4299185vke.7.2020.06.26.13.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2020 13:53:10 -0700 (PDT) From: Alain Michaud To: linux-bluetooth@vger.kernel.org Cc: Alain Michaud Subject: [BlueZ PATCH v1] profiles/scanparam: use configured scanparams when available Date: Fri, 26 Jun 2020 20:53:06 +0000 Message-Id: <20200626205306.803784-1-alainm@chromium.org> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch updates the scan parameter service to use the configured scan parameters when available rather than the hardcoded kernel defaults. --- profiles/scanparam/scan.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c index 9e8f57747..fd22b876b 100644 --- a/profiles/scanparam/scan.c +++ b/profiles/scanparam/scan.c @@ -45,12 +45,11 @@ #include "src/shared/gatt-db.h" #include "src/shared/gatt-client.h" #include "attrib/att.h" +#include "src/hcid.h" #define SCAN_INTERVAL_WIN_UUID 0x2A4F #define SCAN_REFRESH_UUID 0x2A31 -#define SCAN_INTERVAL 0x0060 -#define SCAN_WINDOW 0x0030 #define SERVER_REQUIRES_REFRESH 0x00 struct scan { @@ -75,8 +74,15 @@ static void write_scan_params(struct scan *scan) { uint8_t value[4]; - put_le16(SCAN_INTERVAL, &value[0]); - put_le16(SCAN_WINDOW, &value[2]); + /* Unless scan parameters are configured, use the known kernel default + * parameters */ + put_le16(main_opts.default_params.le_scan_interval_autoconnect ? + main_opts.default_params.le_scan_interval_autoconnect : + 0x60, &value[0]); + + put_le16(main_opts.default_params.le_scan_win_autoconnect ? + main_opts.default_params.le_scan_win_autoconnect : + 0x30, &value[2]); bt_gatt_client_write_without_response(scan->client, scan->iwhandle, false, value, sizeof(value)); -- 2.27.0.212.ge8ba1cc988-goog