Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1588985pxp; Thu, 10 Mar 2022 08:16:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyO4dIzR8TtKNDGoLRHpXfKA49odAzU/kcYensmV1gpjivEtGhdua4KVc3H6r724rNG1c8D X-Received: by 2002:a05:6402:50c8:b0:416:2ae0:4bb3 with SMTP id h8-20020a05640250c800b004162ae04bb3mr5170163edb.132.1646929014876; Thu, 10 Mar 2022 08:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646929014; cv=none; d=google.com; s=arc-20160816; b=vhodJXpzt+HIyru6nvvCVylaupvBvrxcbuCcysp0VUAnwXU9XxPM+LF+J2DThN1R9k PX4qabNxWLU7efqLMkMnyqA6p3OQUYK9DMWvthVPZzH+HTgoVDBBfx5dUonVB6e4NAKz tIUy0AtldpnfmbSMh3wMhuM2uELDGuLKMPGQZ+GNkYWueXBx2nmw50J0ICKJOZ/XirMf iEvCk9IdLjnxu+F35lYsAsvsJA8EvX4wab2pl0w1AyPExEDQEt55OCj5utQqhOLOcjAk AR0zper2ItC6YlMhGo2i7D9fFPDFD98udCSCJbHSnobLSKOTpNN3QPesbgFA5N4/MlJs 8Yig== 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=JEU7ee569p+vgQ2rlGkuRI8+ynD1ujzhla+J+Wlp5ZY=; b=HZfE46tDbdFPRYMPREZpV12idHvNh4TTDSWe13b9ZQcIB9QDPml0ab5nRV12IMdV1M LfOIBOfB22mT0xVkJjjrN6mjWGivHKtlkUo6AjSxmFziTgRfZedG/aBWIa2uOisGNFDV jGzXl+MgdPnlLrR380+3Rb+t6Py0E2nDl+9UoAagjAuDIrPv4zMLxk4Zd6VH4LMD1Gb2 4dexJVmhNC8yEq7xHb0mLEfSvD1nCEhQ4VeqhmKrdSH7ca4fJs/9shiekocyyxN5mC8p PNFhOXVCoJiJKttPtHBfRWldTuJ0XGJHkymzCuLuB55OIcXJoXXaGQEuKjnQblJbiK/C dI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=kQpJCpis; 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 hz1-20020a1709072ce100b006da8c731c77si3373752ejc.326.2022.03.10.08.16.12; Thu, 10 Mar 2022 08:16:54 -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=kQpJCpis; 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 S237144AbiCIRMU (ORCPT + 99 others); Wed, 9 Mar 2022 12:12:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237139AbiCIRMK (ORCPT ); Wed, 9 Mar 2022 12:12:10 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FD8010E55A for ; Wed, 9 Mar 2022 09:05:47 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id bg10so6544406ejb.4 for ; Wed, 09 Mar 2022 09:05:47 -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=JEU7ee569p+vgQ2rlGkuRI8+ynD1ujzhla+J+Wlp5ZY=; b=kQpJCpisR5yQeO5+PI3cN7evuO3FaDDVTMEAvDRAvv9RftWl55wnWv5FnZNNsWb+eA w3FJYm7cZIuPyz08ed6jFEdv1QQFOtdp+lwUEQ1LzaafedKyqvlo3vDgJ9NMUMFO/sxd vAnjKK27xTU7/8PEWEiRAsjzNys2qJlNFIcFw= 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=JEU7ee569p+vgQ2rlGkuRI8+ynD1ujzhla+J+Wlp5ZY=; b=64h4+hsWgZ1l/Q8SkRW0qFdlxLYMMSRL+vxWRaSO+d9nSqdMK4GfAHvV78dK1Vc2lQ XEl3E/z3/6ZqG0W3NnNdBfVwohCS2gU6grlsq1tfShyHMLtzo/fOQw87ERB+pM6slZrz +laQyLMouZNj1wSA+mlp7PwUromwDzfNueY4x6bUbJZIsLgVisjWEfftLQ2MYBTRZRlp 9vuTQqhkClUDZ9XJRZIDFcoyBiWUl+w5ivW2Bye4vsx7UKt6Fr5rMSsjggVZtG3R0SFi E781MBdzByiryjIaNJeeif4jR3ST5OqRlicJYMaZPT+a/MLhTbQhW23q3ex3VoOO2V5i VQpA== X-Gm-Message-State: AOAM532bMpFAGoRDgLAWiDZ2VN1P+7zLY/4WBRu0//8FPF2aO3FCV8zq F9oxKM8Lv3jQCnI0e5gjZ7W/PjRI9GvEpQ== X-Received: by 2002:a17:906:a148:b0:6cd:50c7:8d4d with SMTP id bu8-20020a170906a14800b006cd50c78d4dmr635097ejb.641.1646845545454; Wed, 09 Mar 2022 09:05:45 -0800 (PST) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com. [209.85.208.51]) by smtp.gmail.com with ESMTPSA id a102-20020a509eef000000b0041614c8f79asm1090552edf.88.2022.03.09.09.05.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Mar 2022 09:05:44 -0800 (PST) Received: by mail-ed1-f51.google.com with SMTP id h13so3723288ede.5 for ; Wed, 09 Mar 2022 09:05:44 -0800 (PST) X-Received: by 2002:a05:6402:718:b0:415:a0e5:48c with SMTP id w24-20020a056402071800b00415a0e5048cmr443138edx.156.1646845543873; Wed, 09 Mar 2022 09:05:43 -0800 (PST) MIME-Version: 1.0 References: <6f8f47ceebfbcfd7fa8b04a4df807ae822e2960c.camel@hadess.net> In-Reply-To: From: Sonny Sasaka Date: Wed, 9 Mar 2022 09:05:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] Bluetooth: Adding support for /etc/bluetooth/main.conf.d To: Bastien Nocera Cc: 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 Bastien, On Wed, Mar 9, 2022 at 1:17 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 Blue= tooth > > > > controllers. These keyboards aren=E2=80=99t able to connect to the > > > > device. > > > > Since those connection parameters improve the connection interval > > > > for > > > > most other chipsets, we want to leave the default values but have > > > > 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 common > > > > 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 file fr= om > > > > /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 existing > > > patterns, the OS-supplied stock configuration would be in > > > /usr/lib/bluetooth/main.conf.d (maybe with the default .conf in the > > > 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/ The proposal doesn't actually define the location of the .d directory, the proposal only states that bluetoothd will have the capability to have a .d directory defined at compile time and used at runtime. As I mentioned earlier, this is where configurability at build time will be useful. For example, for the enterprise distribution that you just mentioned, BlueZ can be configured to have the stock conf at /usr/lib/bluetooth/main.conf (locked down), and user/admin overrides at /etc/bluetooth/main.conf.d. If I understand your concern correctly, this should solve the problem with this different configuration file layout. If I misunderstand something let me know. > > > 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. Could you elaborate why providing a .d overrides directory isn't right? I can mention an example use case: BlueZ ships at a distro with certain values of MinConnectionInterval and MaxConnectionInterval in the stock configuration. The user realizes that these values don't work well with the Bluetooth controller hardware, maybe LE keyboards don't reconnect well. They then want to configure this values, but don't want to edit the stock conf because maybe it's locked or they don't want to mess with files provided with the package manager. The user can then use the override directory to customize the values for MinConnectionInterval and MaxConnectionInterval to make the keyboard work. I think that the proposal solves the use case above. If you think this is not the right approach, could you elaborate why and suggest an alternative we can consider?