Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3522429pxb; Tue, 19 Apr 2022 04:38:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZQphNMKS3b7ZzXeV3B30N7/2r56m1QQIglcGJVvqFk4TdN9Oo/TF0BdT7XelcNqZbnykb X-Received: by 2002:a05:6a00:198c:b0:4fa:c717:9424 with SMTP id d12-20020a056a00198c00b004fac7179424mr17155465pfl.63.1650368322388; Tue, 19 Apr 2022 04:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650368322; cv=none; d=google.com; s=arc-20160816; b=V0boDDci6cSi2x6MIfilQzGR+Oio++jHp/tdVFy3VsjFoKo853nzNg6OkzD5C5ung0 ksKstIghWFGPhkummRaSazQ5CxRagXQdcnp2AACHnbbnRrAsHdbpLrBQHyG8KDnLjwgX SipGY1NRWtYnVc9nAz2C32areMN7k+CGjTTH4IIPpGMhgpz11WHvpKORYa14+DNquBBr X4Z11hdczpSplfXNj1L/dU8dgwCYbP7mstBETQrtNH451umEjIb3ZW+iDr721ZsW17NQ MWiOnHHiihmtPxkGTRkht9IXunjNmbvkBISk/cbXLhxl3+oyYaSR7wsA6HqHhQUNOAiS NTkQ== 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=J4fQ1sbrTzCPe8F0h2/Mb9uvYB05Y9+IAxgHDfMAAZE=; b=v3dhhLK80laCE3ylzDnNGmP6vjMvBGb4OA+cm+A2EpCY09ONu2lKkxDILT3/vPvNhm X7aOUzGjvSDq/Fmn8lMrqFoFM9Nzv73kMviFIC/RXwoWl0lHgYeTgtNcONtBcFkzGpPn 1Xwy+/hAOrnSAk8S3uoNlJJwpz/WxotO2APw5s1SR9tJ7Ylk3CJUAZFHmf35ChXcNgR0 SqzQwSMWzFmSl7QWorc+UwMtdoOaVbp2fWf/+9wlv7yPlz6owt+GMVZlXsctBmHkNzCP oA+KZVUjIs8rQKSy9R0mJ5Ol2SvxkeSi6Xxzl5k+EB42Fo1QlaBK6VWr2TstlSzymGvN 2dgA== 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 na10-20020a17090b4c0a00b001ce9d89a175si2065799pjb.0.2022.04.19.04.37.47; Tue, 19 Apr 2022 04:38:41 -0700 (PDT) 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 S1350130AbiDSIv3 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 19 Apr 2022 04:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350132AbiDSIv2 (ORCPT ); Tue, 19 Apr 2022 04:51:28 -0400 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2D84022B1B for ; Tue, 19 Apr 2022 01:48:45 -0700 (PDT) Received: from smtpclient.apple (p4fefc32f.dip0.t-ipconnect.de [79.239.195.47]) by mail.holtmann.org (Postfix) with ESMTPSA id 1B959CECDC; Tue, 19 Apr 2022 10:48:44 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [PATCH BlueZ] policy: Change AutoEnable default to true From: Marcel Holtmann In-Reply-To: <20220413222425.187199-1-luiz.dentz@gmail.com> Date: Tue, 19 Apr 2022 10:48:43 +0200 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <61417C2F-0009-4123-8F1C-DACC4A46073D@holtmann.org> References: <20220413222425.187199-1-luiz.dentz@gmail.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3696.80.82.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 Luiz, > This changes the default of AutoEnable to true so controllers are power > up by default. > > Fixes: https://github.com/bluez/bluez/issues/328 > --- > plugins/policy.c | 6 +++++- > src/main.conf | 4 ++-- > 2 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/plugins/policy.c b/plugins/policy.c > index 48f5db7d3..0bbdbfc88 100644 > --- a/plugins/policy.c > +++ b/plugins/policy.c > @@ -892,7 +892,11 @@ static int policy_init(void) > } > > auto_enable = g_key_file_get_boolean(conf, "Policy", "AutoEnable", > - NULL); > + &gerr); > + if (gerr) { > + g_clear_error(&gerr); > + auto_enable = true; > + } > > resume_delay = g_key_file_get_integer( > conf, "Policy", "ResumeDelay", &gerr); > diff --git a/src/main.conf b/src/main.conf > index 401796235..91b98b8c4 100644 > --- a/src/main.conf > +++ b/src/main.conf > @@ -276,8 +276,8 @@ > > # AutoEnable defines option to enable all controllers when they are found. > # This includes adapters present on start as well as adapters that are plugged > -# in later on. Defaults to 'false'. > -#AutoEnable=false > +# in later on. Defaults to 'true'. > +#AutoEnable=true so this is problematic since all wireless technology daemon where design to not automatically activate their hardware. It needed a system above like ConnMan, NetworkManager or even the UI to start the operation. It is especially tricky since bluetoothd doesn’t remember the last state. So if you power off, then restart, it is on again the next time around. Not something you might have wanted. Using false here is the right choice as a default. If you install systemd-rfkill and want to auto-power once soft-rfkill is released and systemd-rfkill remembers the state persistently, then you need to install your main.conf with AutoEnable=true. That is a distro choice. Regards Marcel