Skip to contentSkip to conversation

tools/sdptool: report error when local SDP server is not found

PATCH In review Magdalena Trivina Sihotang 3 participants 3 messages Jan 28 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/sdptool: report error when local SDP server is not found

From: Magdalena Trivina <[email protected]>

Currently, the sdptool add, setattr and setseq commands do not report any error when the local SDP server is unavailable.

Add an explicit error message so users can distinguish between successful execution and failure due to a missing local server.

---
 tools/sdptool.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tools/sdptool.c +9 -3
index 4e95a18d0..4f4dd41ac 100644
@@ -871,8 +871,10 @@ static int cmd_setattr(int argc, char **argv)
 
 	/* Do it */
 	sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	status = set_attrib(sess, handle, attrib, argv[2]);
 	sdp_close(sess);
@@ -1033,8 +1035,10 @@ static int cmd_setseq(int argc, char **argv)
 
 	/* Do it */
 	sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	status = set_attribseq(sess, handle, attrib, argc, argv);
 	sdp_close(sess);
@@ -3692,8 +3696,10 @@ static int add_service(bdaddr_t *bdaddr, svc_info_t *si)
 		return -1;
 
 	sess = sdp_connect(&interface, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
-	if (!sess)
+	if (!sess) {
+		printf("No local SDP server!\n");
 		return -1;
+	}
 
 	for (i = 0; service[i].name; i++)
 		if (!strcasecmp(service[i].name, si->name)) {
Signature · 1 line
2.34.1
#1 lore raw

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

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1048150

---Test result---

Test Summary:

CheckPatch                    PENDING   0.31 seconds
GitLint                       PENDING   0.43 seconds
BuildEll                      PASS      19.95 seconds
BluezMake                     PASS      635.71 seconds
MakeCheck                     PASS      18.34 seconds
MakeDistcheck                 PASS      243.44 seconds
CheckValgrind                 PASS      294.09 seconds
CheckSmatch                   PASS      349.52 seconds
bluezmakeextell               PASS      183.15 seconds
IncrementalBuild              PENDING   0.40 seconds
ScanBuild                     PASS      1024.20 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Magdalena Trivina Sihotang

Hi Magdalena,

Quoted 55 lines · Magdalena Trivina Sihotang

From: Magdalena Trivina <[email protected]>

Currently, the sdptool add, setattr and setseq commands do not report any error when the local SDP server is unavailable.

Add an explicit error message so users can distinguish between successful execution and failure due to a missing local server.

---
 tools/sdptool.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
tools/sdptool.c +9 -4
index 4e95a18d0..4f4dd41ac 100644
@@ -871,8 +871,10 @@ static int cmd_setattr(int argc, char **argv)
 
        /* Do it */
        sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-       if (!sess)
+       if (!sess) {
+               printf("No local SDP server!\n");
                return -1;
+       }
 
        status = set_attrib(sess, handle, attrib, argv[2]);
        sdp_close(sess);
@@ -1033,8 +1035,10 @@ static int cmd_setseq(int argc, char **argv)
 
        /* Do it */
        sess = sdp_connect(BDADDR_ANY, BDADDR_LOCAL, 0);
-       if (!sess)
+       if (!sess) {
+               printf("No local SDP server!\n");
                return -1;
+       }
 
        status = set_attribseq(sess, handle, attrib, argc, argv);
        sdp_close(sess);
@@ -3692,8 +3696,10 @@ static int add_service(bdaddr_t *bdaddr, svc_info_t *si)
                return -1;
 
        sess = sdp_connect(&interface, BDADDR_LOCAL, SDP_RETRY_IF_BUSY);
-       if (!sess)
+       if (!sess) {
+               printf("No local SDP server!\n");
                return -1;
+       }
 
        for (i = 0; service[i].name; i++)
                if (!strcasecmp(service[i].name, si->name)) {
--
Quoted 1 line

2.34.1

Tools such as sdptool shall be considered deprecated, if you want to add records please use:

https://github.com/bluez/bluez/blob/master/doc/org.bluez.ProfileManager.rst

Signature · 1 line
Luiz Augusto von Dentz