Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp462127ybg; Fri, 12 Jun 2020 06:16:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY5vCl3seMu5YHgwZQfFqtL5LpplLQcZR95Lq2bqlgllSx5QFogX5JM5EMARfbMIAPNIbJ X-Received: by 2002:a05:6402:3c2:: with SMTP id t2mr11599372edw.361.1591967772576; Fri, 12 Jun 2020 06:16:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591967772; cv=none; d=google.com; s=arc-20160816; b=xtqk+SV59euqwnKNyCRAFS4A6L//GlpfRGFud5JH/bG2a8cpQLi0AKuNQb6zyQUqVJ nrPUP20MZGg2n5Ak9RKrXTO37manioFgrBi8ntsE+2dIvirB1Q0xzQFanV8rcl5CI4z5 7EG571+ZY+Hzc5lAp0BDN4uNRDstSmxTVJp2O1oOBBEify+qMbXmGAg4eDRhO8xm69vX /KiOmsuamT7ACsEyEj7Z9ySbJO+r9zqoRI7/HQg8YSiwcEL5xumERaKE3ibJ2lhoNbDx OCB4QH5y4IrnLxvvNyMTeJWVUfRzJVW8bsh6w4q6sTnO0RnuiC5SohuT0P9MD2kty9Zn oIbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fB7h5aGVZCZlnw/x7mgCPvH1+uJfpLmS/jVaOuiinew=; b=GWgwDup8wtbKJXArf2B5MvTiDTHeuh+Y997M+ZkzYma+pXTWMS6lSXfdD346U3qcRZ BL4DeCj13rCQKsM9Z8WypYk7F7DIoR6VxRCXcWtpOhp1M6H2AgL4lFWV9QSJMBtfbTl2 64svAi0tggcuxXWTwDW7kQ8BBy6UuA1uXPnkBIXcsktleXNEq/p3SqRoFwp+9A4AapVr 0imcoNQQJVwMC7gePUiMgxDsDa68ychgJL2vOZVW/9A7pmjIiR39KEgOfto05ujCwC2+ nzW6BExcWQP+JiKPMKiqe6/acT80NyXvUaZc7X5qYtNXbEifS9f8+lFpAr//jhFsyUlv UJXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Mew7uM/j"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm20si4228859ejc.159.2020.06.12.06.15.48; Fri, 12 Jun 2020 06:16:12 -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=@kernel.org header.s=default header.b="Mew7uM/j"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726053AbgFLNNg (ORCPT + 99 others); Fri, 12 Jun 2020 09:13:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:46084 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgFLNNg (ORCPT ); Fri, 12 Jun 2020 09:13:36 -0400 Received: from pali.im (pali.im [31.31.79.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 60418206A4; Fri, 12 Jun 2020 13:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591967615; bh=fBpxUt7Rb+PkHN6rHIz7FZn4p/kBn/nnTDFiCe2UU6w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Mew7uM/jRd2an3dka8uEPxtVBhsRy7sxxMQj3eqWWQd8qqKZioXbByB77eRpnydXK VXPPkyh5ZcaefFBnyOjv0W4rSG0uPx1mDhLRbPKoP3VDN01Hg/ciYkvBPHfxUHEAXK m3X5yzkeyjhsX+RAxnP3tIfnFhVY+E0qhnm09+Os= Received: by pali.im (Postfix) id B0ED7582; Fri, 12 Jun 2020 15:13:33 +0200 (CEST) Date: Fri, 12 Jun 2020 15:13:33 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Luiz Augusto von Dentz Cc: "linux-bluetooth@vger.kernel.org" , Luiz Augusto von Dentz Subject: Re: [PATCH] sap: Improve error messages Message-ID: <20200612131333.jrrv3bue7kagyd7k@pali> References: <20200604232433.4951-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Friday 05 June 2020 00:14:12 Luiz Augusto von Dentz wrote: > Hi Pali, > > On Thu, Jun 4, 2020 at 4:27 PM Pali Rohár wrote: > > > > When bluetoohd daemon is starting, it prints following error messages: > > > > bluetoothd[19117]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed. > > bluetoothd[19117]: sap-server: Operation not permitted (1) > > > > Initialization is failing because sap server is enabled only when > > bluetoothd daemon is started with --experimental option. > > > > And "Operation not permitted" is result of returning error code -1. > > > > This patch improves error messages. When --experimental option is not used > > then bluetoothd prints more explaining error message. And in case function > > sap_init() fails then -EOPNOTSUPP "Operation not supported" is returned > > instead of -EPERM (-1). > > --- > > profiles/sap/server.c | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/profiles/sap/server.c b/profiles/sap/server.c > > index 5de682a33..99ff80297 100644 > > --- a/profiles/sap/server.c > > +++ b/profiles/sap/server.c > > @@ -1353,9 +1353,14 @@ int sap_server_register(struct btd_adapter *adapter) > > GIOChannel *io; > > struct sap_server *server; > > > > + if (!(g_dbus_get_flags() & G_DBUS_FLAG_ENABLE_EXPERIMENTAL)) { > > + error("Sap driver is disabled without --experimental option"); > > + return -EOPNOTSUPP; > > + } > > + > > if (sap_init() < 0) { > > error("Sap driver initialization failed."); > > - return -1; > > + return -EOPNOTSUPP; > > } > > > > record = create_sap_record(SAP_SERVER_CHANNEL); > > -- > > 2.20.1 > > We might as well introduce a experimental flag for the plugin so it > just don't load it if experimental flag is disabled. Probably yet. But returning -1 (-EPERM) should be also fixed.