Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4103534pxk; Tue, 29 Sep 2020 14:36:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNKLKYACMIZMGULv91juwZLBLtcMgaj6ZTHI+GbmpWwTla6R/8CHNQafaJ5/0Hw2u3nWor X-Received: by 2002:a17:906:552:: with SMTP id k18mr5856292eja.482.1601415408375; Tue, 29 Sep 2020 14:36:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601415408; cv=none; d=google.com; s=arc-20160816; b=zThb80yxw3jlhafraOHNUFcu4ODRJurZkgozSe/iUpul67qNMYfFSgwASumTdgynb9 NC6S3aXNHmR4bMS746lL0Q+/Tzrrg7g8DO3yCPGt1a/kVGN38XoGQ+g+rI7i8YAbGgyn nxd1YjuYAzVQ0+LzOJUXAENYRRFGUS5N4fPYsE4aR4/zkAEDTrnaN4bMSb650Vlz/eZm 2UtC4oDqLI5Xnjt3qJzUDwKJa759uZut0UdLrULvy0IiJ9+mKGD6ixpY/ButDhfzuNuw LROvG32csX9t/aR0e4rqILKXB/7/ndeODJcJcxT7YuKXvgWPZyTSghfPF+flP5iACKi2 QYSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vJceDOtodL3pxXWKo9iv57s5JULQoTGUI1MpVdGjsEs=; b=WvakGEcSqGuzQhvFa4e4zBfvl/gpA+K3VXQ/yy9/WHULUsF56akPWjJZ/Os/3sK50c P8ZOwP/Beq8oY+Eg2P0CXpfQDZZ+yeVwdUmhxYmyj7Kq/rZy1b9jD/JVhFHEEDZ7tzKI BLwIbEtgW2a9JzhAv+QkjmRg3RQRhf1LfANSaVSbkhsLH/YF4ObNU9P6gehqKk7cop3A 03HENGZCzHhdnrl+zM8p8bUj4RZSrscsbDQdCCHciNlFniMWUNj3b6imqFSiXWo9sdAR 5Q66nYrOmMcNx/5CuDtrQ4YC16zEsoJHBXkr5U8PV67qdnuJc+a0fe2Nj1DjLqZ4CUoP LIVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=I4NSQ8Hu; 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 mf3si3560787ejb.27.2020.09.29.14.36.19; Tue, 29 Sep 2020 14:36:48 -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=I4NSQ8Hu; 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 S1728025AbgI2VgP (ORCPT + 99 others); Tue, 29 Sep 2020 17:36:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:53042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbgI2VgP (ORCPT ); Tue, 29 Sep 2020 17:36:15 -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 2C5E32083B; Tue, 29 Sep 2020 21:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601415374; bh=IyUPvHwtwjBwRcNc/SJufenELAwR9GBKSApZpl2oKIk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=I4NSQ8HuYZhkZhFjb2U4jInavU0ouTcjPXMN/r6J7gDZnQouh4bcu+22ElleQklxW WQAXcr073Nfl9W4ezdYN32Uy1xPrK5yc2RSdF60fGk+97QkpAErlquSPU6cX0Z3mot zZL3bcrwCQlhysRCOdYtcAaH/8uZRhIiDAtNKcuY= Received: by pali.im (Postfix) id 0C846AA6; Tue, 29 Sep 2020 23:36:12 +0200 (CEST) Date: Tue, 29 Sep 2020 23:36:11 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Szymon Janc Cc: linux-bluetooth@vger.kernel.org, Luiz Augusto von Dentz Subject: Re: [PATCH] sap: Improve error messages Message-ID: <20200929213611.6q6hzkg3kr5kvuex@pali> References: <20200604232433.4951-1-pali@kernel.org> <4237143.LvFx2qVVIh@ix> <20200716144008.fcgxcqmqfashnwam@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200716144008.fcgxcqmqfashnwam@pali> User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Thursday 16 July 2020 16:40:08 Pali Rohár wrote: > On Monday 15 June 2020 11:48:20 Szymon Janc wrote: > > Hi, > > > > On Friday, 5 June 2020 01:24:33 CEST 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; > > > + } > > > + > > > > Maybe just make sap_init() fail if experimental is not enabled in sap-dummy.c? > > I guess this is what is already happening. But failure of sap_init() > means that bluetoothd daemon prints error message that initialization > failed as I wrote in commit message. > > Therefore I added another check for experimental flag with printing > different error message which contains information why it failed. Szymon, do you need something more? > > This driver is usable only for profile qualification tests and nothing more. > > And TBH I'm not sure why distros are enabling SAP in first place... > > > > > if (sap_init() < 0) { > > > error("Sap driver initialization failed."); > > > - return -1; > > > + return -EOPNOTSUPP; > > > } > > > > > > record = create_sap_record(SAP_SERVER_CHANNEL); > > > > > > -- > > pozdrawiam > > Szymon Janc > > > >