2020-04-26 21:03:24

by Pali Rohár

[permalink] [raw]
Subject: [PATCH] device: Return error when ConnectProfile DBus method fails (second fix)

This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
another place which needs to distinguish between Connect and ConnectProfile
DBus method.
---
src/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 229579378..7b0eb256e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
dev->pending = create_pending_list(dev, uuid);
if (!dev->pending) {
if (dev->svc_refreshed) {
- if (find_service_with_state(dev->services,
+ if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
+ "Connect") &&
+ find_service_with_state(dev->services,
BTD_SERVICE_STATE_CONNECTED))
return dbus_message_new_method_return(msg);
else
--
2.20.1


2020-04-26 21:07:29

by bluez.test.bot

[permalink] [raw]
Subject: RE: device: Return error when ConnectProfile DBus method fails (second fix)


This is automated email and please do not replay to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While we are preparing for reviewing the patches, we found the following
issue/warning.


Test Result:
Checkpatch Failed

Patch Title:
device: Return error when ConnectProfile DBus method fails (second fix)

Output:
ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'commit 3aa815a31017 ("device: Return error when ConnectProfile DBus method fails")'
#7:
This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is

- total: 1 errors, 0 warnings, 10 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

Your patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPLIT_STRING

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.



For more details about BlueZ coding style guide, please find it
in doc/coding-style.txt

---
Regards,
Linux Bluetooth

2020-04-27 16:45:33

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [PATCH] device: Return error when ConnectProfile DBus method fails (second fix)

Hi Pali,

On Sun, Apr 26, 2020 at 2:05 PM Pali Rohár <[email protected]> wrote:
>
> This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
> another place which needs to distinguish between Connect and ConnectProfile
> DBus method.
> ---
> src/device.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/device.c b/src/device.c
> index 229579378..7b0eb256e 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
> dev->pending = create_pending_list(dev, uuid);
> if (!dev->pending) {
> if (dev->svc_refreshed) {
> - if (find_service_with_state(dev->services,
> + if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
> + "Connect") &&
> + find_service_with_state(dev->services,
> BTD_SERVICE_STATE_CONNECTED))

Perhaps it would be better to have a helper function that checks this for us.

> return dbus_message_new_method_return(msg);
> else
> --
> 2.20.1
>


--
Luiz Augusto von Dentz

2020-04-27 18:15:31

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH] device: Return error when ConnectProfile DBus method fails (second fix)

On Monday 27 April 2020 09:44:50 Luiz Augusto von Dentz wrote:
> Hi Pali,
>
> On Sun, Apr 26, 2020 at 2:05 PM Pali Rohár <[email protected]> wrote:
> >
> > This is fixup of commit 3aa815a31017e8793b030b04ef704ce85455b9aa. There is
> > another place which needs to distinguish between Connect and ConnectProfile
> > DBus method.
> > ---
> > src/device.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/device.c b/src/device.c
> > index 229579378..7b0eb256e 100644
> > --- a/src/device.c
> > +++ b/src/device.c
> > @@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
> > dev->pending = create_pending_list(dev, uuid);
> > if (!dev->pending) {
> > if (dev->svc_refreshed) {
> > - if (find_service_with_state(dev->services,
> > + if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
> > + "Connect") &&
> > + find_service_with_state(dev->services,
> > BTD_SERVICE_STATE_CONNECTED))
>
> Perhaps it would be better to have a helper function that checks this for us.

I do not know if it helps, but I think this is the last problem which I
observed with connect/disconnect profile method.

> > return dbus_message_new_method_return(msg);
> > else
> > --
> > 2.20.1
> >
>
>
> --
> Luiz Augusto von Dentz

2020-05-03 11:11:27

by Pali Rohár

[permalink] [raw]
Subject: [PATCH v2] device: Return error when ConnectProfile DBus method fails (second fix)

This is fixup of commit 3aa815a31017 ("device: Return error when
ConnectProfile DBus method fails"). There is another place which needs
to distinguish between Connect and ConnectProfile DBus method.
---
src/device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/device.c b/src/device.c
index 229579378..7b0eb256e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1861,7 +1861,9 @@ static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type
dev->pending = create_pending_list(dev, uuid);
if (!dev->pending) {
if (dev->svc_refreshed) {
- if (find_service_with_state(dev->services,
+ if (dbus_message_is_method_call(msg, DEVICE_INTERFACE,
+ "Connect") &&
+ find_service_with_state(dev->services,
BTD_SERVICE_STATE_CONNECTED))
return dbus_message_new_method_return(msg);
else
--
2.20.1