Re: [PATCH] sap: Improve error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <pali@xxxxxxxxxx> 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.



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux