Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1650646pxp; Thu, 10 Mar 2022 09:22:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzWVndcJPrhKN3OvnM366RfvtEd8CVHu4XiDn/OH5nS1t0HkGVRgqZgK8BLrEXF3IQbwXZf X-Received: by 2002:a17:902:930b:b0:14d:b0c0:1f71 with SMTP id bc11-20020a170902930b00b0014db0c01f71mr6118595plb.113.1646932925773; Thu, 10 Mar 2022 09:22:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646932925; cv=none; d=google.com; s=arc-20160816; b=EAeWaPlog1WOOGOPqJKBlPSRzRKg4aYjaiblmfac2T8K5jVd4VVII3/dhX0pXhJqKn oEGaTSYUGDd98egQ9LP94tgp5CUQau0hhZ+4eAtP7YEdmnMU8YF3kJ7jtzHWj4rUOT4A J+NUdflkf83H8k/rQfPxYlyj/usvaZZV15G00w2dE7P/iNcGEmHnsRTJLuYQV4GGRM18 SjBCa1eQiMRs+707egpE3ub347AWgbElZPvopSfEGHDbk5A9SBfjaLMJgxmSeAYkqSuK ekUODn5/D52T+sVjZESxhVPGh3myNr/SwlnV7xUDEUC+uICMOPuOvkrqZO53nxe86ir+ 6y1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=1QObfBMXdbP3BoiTCXpJmEhSsYsJ34oyCXk93GH6uGs=; b=fMOQnxrUu1RVKA+cDrrJQoEYJxndfi2+1jR/vDWHILSypDPHz0enq3PVgl3T/oECjt XpDko3ioB7qMoIsXbf9PIyEiCJZyKikYtDrDC9QZHtPBYfCxrog7pKPubl7hsuYWNcmg VXYrGHRY1cqum4MvrHlupYv5VUa+hxwCWF7Xj0SRursXXECE4jcOyz/5xQliIFT2qbgl cCxQYbKq8qympBoDPiou0tnF6GAULLOFMmYHkhFOPgLAjMw8Yq878PkauhAG3GG72RZ+ 2JzQ2OnuqzudmdkLpFvprZR/Qt6TxpCOKAxTl6p69m0fQf006hQMje9OvsOfkQgVrYGj m4UQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a17090ad98800b001bf0205ffa3si2351501pjv.25.2022.03.10.09.21.35; Thu, 10 Mar 2022 09:22:05 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236153AbiCJJwn convert rfc822-to-8bit (ORCPT + 99 others); Thu, 10 Mar 2022 04:52:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233237AbiCJJwn (ORCPT ); Thu, 10 Mar 2022 04:52:43 -0500 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9921D13AA15 for ; Thu, 10 Mar 2022 01:51:39 -0800 (PST) Received: from smtpclient.apple (p5b3d2183.dip0.t-ipconnect.de [91.61.33.131]) by mail.holtmann.org (Postfix) with ESMTPSA id 8E963CECD8; Thu, 10 Mar 2022 10:51:38 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.60.0.1.1\)) Subject: Re: [RFC] Bluetooth: Adding support for /etc/bluetooth/main.conf.d From: Marcel Holtmann In-Reply-To: Date: Thu, 10 Mar 2022 10:51:37 +0100 Cc: BlueZ , Sonny Sasaka Content-Transfer-Encoding: 8BIT Message-Id: <3DAED89D-72AC-4D38-A092-D2A52AEEE5BB@holtmann.org> References: To: Katherine Lai X-Mailer: Apple Mail (2.3693.60.0.1.1) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Katherine, > It was found that a change to the default settings for > MinConnectionInterval and MaxConnectionInterval in main.conf broke > some of ChromeOS’s keyboard HID tests for only certain Bluetooth > controllers. These keyboards aren’t 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’s main.c, merge the params for each *.conf file 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 actually I rather not do this. Let met try to explain this. In modern distribution layout, the /etc directory is purely for the admin of the system. They can do localized changes. Defaults are meant to be in /usr/lib/ actually. And override is also meant that an /etc file can fully replace an /usr/lib file. We already structured that /etc/bluetooth/main.conf is optional and that package managers / distros should only install it if they really know what they are doing. If an upgrade of a package overwrites /etc/bluetooth/main.conf then it is doing something wrong (mind you we don’t install it by default). That said, some time ago I discussed with Alain, that fundamentally you first need an option to identify your controller, what firmware etc. and then can decide what to load. That thread ended and got no further discussion. Based on that identification we wanted to allow tweaking certain set of parameters to add known good parameters / workaround to broken hardware. If you say, that you already know all of this anyway upfront and your filesystem is specific for a given platform, then use tmpfs for /etc/bluetooth/main.conf or alternatively, we actually introduce support for CONFIGURATION_DIRECTORY. We already have this in iwd and it would make sense to just support it. The CONFIGURATION_DIRECTORY directory comes from systemd (https://www.freedesktop.org/software/systemd/man/systemd.exec.html), but since it is just an environment variable for the bluetoothd process, you can do with any shell by just setting it. Regards Marcel