Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1395115pxp; Thu, 10 Mar 2022 04:50:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBKaHGJTWB/w2PDged2wNcgBpj176Wp8yK5inU9u0O0+fx1VLtiO+mOWUr7+X5zveu92KT X-Received: by 2002:a63:2204:0:b0:378:9f08:206d with SMTP id i4-20020a632204000000b003789f08206dmr4063909pgi.3.1646916658977; Thu, 10 Mar 2022 04:50:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646916658; cv=none; d=google.com; s=arc-20160816; b=DgqmfYJ9C8A1VT/MtUh7AjVL6dJ78x69uaOpkJGlLkP8TMcwJjNfOMn5gc7Rh+UbQc ejnRebmY/Wmz6IN5+T7dIM2o6g4uoF6/l83XI70Z+nqL/tF6M6EmE10izLicItJFc8Js p/Whc3OeQvf59NIqGZmVxygTGR1z1q2pu+SNjGXBsRf3mOt47OGf5y74JlFGWfxVlIiv Sq/pD1tgStDzb15nR7+pRNM8/kpoSZ62SWg2DxhHNM0D5upJv/jzV3K+xcDGfxhZ9HGy JAE4kr3VuLwGCGgK6ZzGd6z3W4GjkfKS6M45api1c/zS1QbAJgGK+pSIYAQ8RHAz3H/T ZSqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=sBaLhq4NRHuRuLzZ8mRj/EriK/+EfMlvthU5xTLb07c=; b=uj/Vg7Q25DaowiKwKxfpMwufr1LTvA2KRp6fWm2j7cGD43QYv7L+UNDXKmi7qYx+ex qOCMWVsOQBVbwi7GXda1nb340cecMVd+T975Lj3FEktDfJmZs8ChyZnvVXUxDeLYB6+K CUR3nrd1ghCCjQFznEAZmNYuL4DaYtO69eLDe4q9spfVUfLPZ49wE6+ixDOookpH0yvM A4RZh2OxtrL4IYIZZsot1WrtqOB6mF9v8xqHYqADlzU7u/B0BRFLKHu7/Vacu41o7GCL xuLLpSaeSupwxe/CB9g4QNwVqPbLsDLaPqZBRQUCbao5wmbEDlPZ+wYyfpXPWmD2kIqw u1Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=a0onYQ08; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x190-20020a6386c7000000b00380caf9907asi3616477pgd.539.2022.03.10.04.50.09; Thu, 10 Mar 2022 04:50:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=a0onYQ08; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235637AbiCIXf6 (ORCPT + 99 others); Wed, 9 Mar 2022 18:35:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232807AbiCIXf5 (ORCPT ); Wed, 9 Mar 2022 18:35:57 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64844FABFB for ; Wed, 9 Mar 2022 15:34:57 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id w4so4828499edc.7 for ; Wed, 09 Mar 2022 15:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=sBaLhq4NRHuRuLzZ8mRj/EriK/+EfMlvthU5xTLb07c=; b=a0onYQ08XIu7lKFXtQdsWiO7qiA4HBj2Vo8iMci596rRm5QTzCVyJ2PLAnEEfHUJIZ zQ81K03Jpj/SG//W4UhQ7thG80Vo/WN0dUOViCUT6/stEYQQxF/mLM0jE29v6RjiooAj fAG+4YcEOBmH/oPiIO2h0JxM1GP0WAStCtk3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=sBaLhq4NRHuRuLzZ8mRj/EriK/+EfMlvthU5xTLb07c=; b=Qzsa0HfljRVG9T56GMVDIGzhmUKw7T0Lv4XBc4joonzTpGMkDc3orRm/z0l9OqsmSC utVtf8mLEd30diQSoDv8/WIGzEfw2/642YFMFmb2O2x+jCJK+NZtFICbSpdQaznNIoYk MGl22brvnjQrOx9Ic5FhBQ9qv71cC3d9HUmR2s0mVUs8Bj14z00mf+MxgChY3Tfncq3u mw1+ZnCx0qPaGH4I7mk9Z99tbuk5eqnS72kLgakk86vZt6Q52bwmAe//ajes/UFwUd2T CAjOuwD6Jnp5Noq28o+IImmi/Mdz+8HaH0RMeO4YZJf5cOLM2vCfe7Y/L4YXPJCLn0jF GPHw== X-Gm-Message-State: AOAM533/oqgywcYvJBmGqxY6AWzE8UU6fQNcPN8EE3f+xW/VKczmDGMK IP5jvmnoa5iimbDJo30EvWYJb+mfVZB2lbUM X-Received: by 2002:a05:6402:440d:b0:412:9e8a:5e51 with SMTP id y13-20020a056402440d00b004129e8a5e51mr1816648eda.362.1646868895613; Wed, 09 Mar 2022 15:34:55 -0800 (PST) Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com. [209.85.218.50]) by smtp.gmail.com with ESMTPSA id d1-20020a17090694c100b006da91d57e93sm1262422ejy.207.2022.03.09.15.34.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Mar 2022 15:34:55 -0800 (PST) Received: by mail-ej1-f50.google.com with SMTP id a8so8457443ejc.8 for ; Wed, 09 Mar 2022 15:34:55 -0800 (PST) X-Received: by 2002:a17:906:2b97:b0:6cd:6d67:ab5d with SMTP id m23-20020a1709062b9700b006cd6d67ab5dmr1916965ejg.723.1646868894429; Wed, 09 Mar 2022 15:34:54 -0800 (PST) MIME-Version: 1.0 References: <6f8f47ceebfbcfd7fa8b04a4df807ae822e2960c.camel@hadess.net> In-Reply-To: From: Sonny Sasaka Date: Wed, 9 Mar 2022 15:34:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Bluetooth: Adding support for /etc/bluetooth/main.conf.d To: Luiz Augusto von Dentz Cc: Bastien Nocera , Katherine Lai , BlueZ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Hi Luiz, On Wed, Mar 9, 2022 at 1:02 PM Luiz Augusto von Dentz wrote: > > Hi, > > On Wed, Mar 9, 2022 at 12:44 PM Luiz Augusto von Dentz > wrote: > > > > Hi, > > > > On Wed, Mar 9, 2022 at 4:10 AM Bastien Nocera wrote= : > > > > > > On Tue, 2022-03-08 at 14:50 -0800, Sonny Sasaka wrote: > > > > Hi Bastien, > > > > > > > > > > > > On Tue, Mar 8, 2022 at 2:14 AM Bastien Nocera > > > > wrote: > > > > > > > > > > Hey Katherine, > > > > > > > > > > On Mon, 2022-03-07 at 10:57 -0800, Katherine Lai wrote: > > > > > > Background > > > > > > > > > > > > It was found that a change to the default settings for > > > > > > MinConnectionInterval and MaxConnectionInterval in main.conf > > > > > > broke > > > > > > some of ChromeOS=E2=80=99s keyboard HID tests for only certain = Bluetooth > > > > > > controllers. These keyboards aren=E2=80=99t able to connect to = the > > > > > > device. > > > > > > Since those connection parameters improve the connection interv= al > > > > > > for > > > > > > most other chipsets, we want to leave the default values but ha= ve > > > > > > a > > > > > > way to have an optional override to address problematic models. > > > > > > > > > > > > > > > > > > Proposed Solution > > > > > > > > > > > > Adding support to bluetoothd for an additional config directory > > > > > > /etc/bluetooth/main.conf.d containing multiple files which will > > > > > > override common params. Override order will be lexically sorted > > > > > > filename order. This pattern is already used by Linux distros, > > > > > > for > > > > > > example there is /etc/sudoers.d which files will override commo= n > > > > > > params in /etc/sudoers. > > > > > > > > > > > > Users can add override config files to /etc/bluetooth/main.conf= .d > > > > > > rather than directly editing /etc/bluetooth/main.conf. This is > > > > > > more > > > > > > friendly to package managers since BlueZ package updates won't > > > > > > cause > > > > > > conflict to /etc/bluetooth/main.conf. > > > > > > > > > > > > In bluez=E2=80=99s main.c, merge the params for each *.conf fil= e from > > > > > > /etc/bluetooth/main.conf.d with the existing > > > > > > /etc/bluetooth/main.conf > > > > > > in lexical filename order > > > > > > > > > > > > /etc/bluetooth/main.conf.d will be configurable at build time, > > > > > > e.g. > > > > > > with ./configure --main-conf-dir > > > > > > > > > > This isn't quite how the pattern is usually used. With the existi= ng > > > > > patterns, the OS-supplied stock configuration would be in > > > > > /usr/lib/bluetooth/main.conf.d (maybe with the default .conf in t= he > > > > > same directory as that subdir), with /etc/bluetooth/main.conf.d > > > > > only > > > > > used for the user/admin override the default configuration. > > > > We did a bit of research and found that /etc/X and /etc/X.d is more > > > > common, e.g. the one described in > > > > https://www.redhat.com/sysadmin/etc-configuration-directories. > > > > > > This is documentation for an enterprise distribution, not how the > > > pattern is now used upstream. > > > > > > $ ls -d1 /usr/lib/*.d/ > > > /usr/lib/binfmt.d/ > > > /usr/lib/environment.d/ > > > /usr/lib/modprobe.d/ > > > /usr/lib/modules-load.d/ > > > /usr/lib/motd.d/ > > > /usr/lib/pam.d/ > > > /usr/lib/sysctl.d/ > > > /usr/lib/sysusers.d/ > > > /usr/lib/tmpfiles.d/ > > > $ ls -d1 /usr/lib/*/*.d/ > > > /usr/lib/dracut/dracut.conf.d/ > > > /usr/lib/dracut/modules.d/ > > > /usr/lib/fedora-third-party/conf.d/ > > > /usr/lib/gconv/gconv-modules.d/ > > > /usr/lib/kernel/install.d/ > > > /usr/lib/NetworkManager/conf.d/ > > > /usr/lib/NetworkManager/dispatcher.d/ > > > /usr/lib/rpm/macros.d/ > > > /usr/lib/systemd/ntp-units.d/ > > > /usr/lib/udev/hwdb.d/ > > > /usr/lib/udev/rules.d/ > > > > > > > If some distribution wants to organize the conf files to > > > > /usr/lib/bluetooth (for stock by package managers) and > > > > /etc/bluetooth/main.conf.d (for admin/users), I guess this is where > > > > having a configurable path is useful. > > > > What do you think? > > > > > > I'm saying this isn't the current pattern, especially for OSes where > > > /usr is locked-down. I still think this isn't the right way to > > > implement this feature. > > > > Before we start doing this we should check if the devices with > > problems don't implement Peripheral Preferred Connection Parameters > > (PPCP) as some of peripherals are not capable of updating the > > connection parameters themselves they depend on the central reading > > the PPCP, some years back we got someone attempting to implement PPCP > > support but the problem was that one needs to load all the devices > > connection parameters with Peripheral Preferred Connection Parameters > > management command, anyway it would be great to have support for PPCP > > even if that means reloading everything or perhaps we introduce > > something at socket level where the user can set the parameters which > > then gets saved once the update connection parameters procedure is > > completed. In our case, the problem is not with the peripherals but with a specific Bluetooth controller of the central. We can't assume that all Bluetooth controllers behave well with a certain configuration, therefore I think that trying to get a one-size-fits-all configuration will likely run into a problem eventually. Also, although it's motivated by a specific issue, the solution that we are proposing is actually a generally helpful feature since there are other parameters that users may override without modifying the original configuration that comes from package manager especially when it is locked down. As a generic override mechanism, what do you think about this proposal? > > Here it is the RFC for the kernel side: > > https://www.spinics.net/lists/linux-bluetooth/msg69520.html > > It probably needs some improvements like checkinf if the conneciton is > really LE, etc. > > > -- > > Luiz Augusto von Dentz > > > > -- > Luiz Augusto von Dentz