From: "Pali Rohár" <pali@kernel.org>
To: Szymon Janc <szymon.janc@codecoup.pl>
Cc: linux-bluetooth@vger.kernel.org,
Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Subject: Re: [PATCH] sap: Improve error messages
Date: Thu, 16 Jul 2020 16:40:08 +0200 [thread overview]
Message-ID: <20200716144008.fcgxcqmqfashnwam@pali> (raw)
In-Reply-To: <4237143.LvFx2qVVIh@ix>
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.
> 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
>
>
next prev parent reply other threads:[~2020-07-16 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 23:24 [PATCH] sap: Improve error messages Pali Rohár
2020-06-05 0:12 ` bluez.test.bot
2020-06-05 0:12 ` bluez.test.bot
2020-06-05 7:14 ` [PATCH] " Luiz Augusto von Dentz
2020-06-12 13:13 ` Pali Rohár
2020-06-15 9:48 ` Szymon Janc
2020-07-16 14:40 ` Pali Rohár [this message]
2020-09-29 21:36 ` Pali Rohár
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200716144008.fcgxcqmqfashnwam@pali \
--to=pali@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.von.dentz@intel.com \
--cc=szymon.janc@codecoup.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox