Skip to contentSkip to conversation

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

PATCH Superseded Pali Rohár 3 participants 6 messages Apr 26, 2020 – May 4, 2020 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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(-)
src/device.c +3 -1
index 229579378..7b0eb256e 100644
@@ -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
Signature · 1 line
2.20.1
#1 lore raw

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

#2 lore raw
In reply to Pali Rohár

Hi Pali,

Quoted 13 lines · Pali Rohár

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(-)
src/device.c +0 -0
index 229579378..7b0eb256e 100644

src/device.c static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type · line 1867

Quoted 8 lines
src/device.c +3 -1
@@ -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.

Quoted 5 lines
src/device.c +0 -1
                                return dbus_message_new_method_return(msg);
                        else
--

2.20.1

Signature · 1 line
Luiz Augusto von Dentz
#3 lore raw
Quoted 11 lines · On Monday 27 April 2020 09:44:50 Luiz Augusto von Dentz wrote:

Hi Pali,

Quoted 8 lines · Pali Rohár

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(-)
Quoted 15 lines

src/device.c static DBusMessage *connect_profiles(struct btd_device *dev, uint8_t bdaddr_type · line 1867

Quoted 13 lines
src/device.c +3 -1
index 229579378..7b0eb256e 100644
@@ -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.

Quoted 9 lines
Quoted 5 lines
src/device.c +0 -1
                                return dbus_message_new_method_return(msg);
                        else
--

2.20.1

Signature · 1 line
Luiz Augusto von Dentz
#4 lore raw

PATCH v2 1/1 device: Return error when ConnectProfile DBus method fails (second fix)

In reply to Pali Rohár

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(-)
src/device.c +3 -1
index 229579378..7b0eb256e 100644
@@ -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
Signature · 1 line
2.20.1
maintainer Applied
#5 lore raw

Hi Pali,

Quoted 24 lines · Pali Rohár

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(-)
src/device.c +3 -2
index 229579378..7b0eb256e 100644
@@ -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
--
Quoted 1 line

2.20.1

Applied, thanks.

Signature · 1 line
Luiz Augusto von Dentz