linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 BlueZ] obexctl: Add optional argument channel to connect command
@ 2022-02-14 23:16 Luiz Augusto von Dentz
  2022-02-15  0:39 ` [v2,BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2022-02-14 23:16 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds a third argument to connect command so a channel can be passed
to CreateSession which is useful since it possible to force a specific
RFCOMM channel.
---
v2: Fix passing Channel argument as DBUS_TYPE_UINT16 rather than
DBUS_TYPE_BYTE.

 tools/obexctl.c | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/tools/obexctl.c b/tools/obexctl.c
index e671d253b..56a76915c 100644
--- a/tools/obexctl.c
+++ b/tools/obexctl.c
@@ -114,6 +114,7 @@ static void connect_reply(DBusMessage *message, void *user_data)
 struct connect_args {
 	char *dev;
 	char *target;
+	uint8_t channel;
 };
 
 static void connect_args_free(void *data)
@@ -139,13 +140,14 @@ static void connect_setup(DBusMessageIter *iter, void *user_data)
 					DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
 					&dict);
 
-	if (args->target == NULL)
-		goto done;
-
-	g_dbus_dict_append_entry(&dict, "Target",
+	if (args->target)
+		g_dbus_dict_append_entry(&dict, "Target",
 					DBUS_TYPE_STRING, &args->target);
 
-done:
+	if (args->channel)
+		g_dbus_dict_append_entry(&dict, "Channel",
+					DBUS_TYPE_BYTE, &args->channel);
+
 	dbus_message_iter_close_container(iter, &dict);
 }
 
@@ -153,6 +155,7 @@ static void cmd_connect(int argc, char *argv[])
 {
 	struct connect_args *args;
 	const char *target = "opp";
+	int channel = 0;
 
 	if (!client) {
 		bt_shell_printf("Client proxy not available\n");
@@ -162,9 +165,20 @@ static void cmd_connect(int argc, char *argv[])
 	if (argc > 2)
 		target = argv[2];
 
+	if (argc > 3) {
+		char *endptr = NULL;
+
+		channel = strtol(argv[3], &endptr, 0);
+		if (!endptr || *endptr != '\0' || channel > UINT8_MAX) {
+			bt_shell_printf("Invalid channel\n");
+			return bt_shell_noninteractive_quit(EXIT_FAILURE);
+		}
+	}
+
 	args = g_new0(struct connect_args, 1);
 	args->dev = g_strdup(argv[1]);
 	args->target = g_strdup(target);
+	args->channel = channel;
 
 	if (g_dbus_proxy_method_call(client, "CreateSession", connect_setup,
 			connect_reply, args, connect_args_free) == FALSE) {
@@ -1832,7 +1846,8 @@ static void cmd_mkdir(int argc, char *argv[])
 static const struct bt_shell_menu main_menu = {
 	.name = "main",
 	.entries = {
-	{ "connect",      "<dev> [uuid]", cmd_connect, "Connect session" },
+	{ "connect",      "<dev> [uuid] [channel]", cmd_connect,
+						"Connect session" },
 	{ "disconnect",   "[session]", cmd_disconnect, "Disconnect session",
 						session_generator },
 	{ "list",         NULL,       cmd_list, "List available sessions" },
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [v2,BlueZ] obexctl: Add optional argument channel to connect command
  2022-02-14 23:16 [PATCH v2 BlueZ] obexctl: Add optional argument channel to connect command Luiz Augusto von Dentz
@ 2022-02-15  0:39 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-02-15  0:39 UTC (permalink / raw)
  To: linux-bluetooth, luiz.dentz

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

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=614281

---Test result---

Test Summary:
CheckPatch                    PASS      1.51 seconds
GitLint                       PASS      0.98 seconds
Prep - Setup ELL              PASS      55.48 seconds
Build - Prep                  PASS      0.95 seconds
Build - Configure             PASS      10.18 seconds
Build - Make                  PASS      1793.79 seconds
Make Check                    PASS      12.13 seconds
Make Check w/Valgrind         PASS      533.60 seconds
Make Distcheck                PASS      293.74 seconds
Build w/ext ELL - Configure   PASS      10.75 seconds
Build w/ext ELL - Make        PASS      1791.47 seconds
Incremental Build with patchesPASS      0.00 seconds



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-15  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 23:16 [PATCH v2 BlueZ] obexctl: Add optional argument channel to connect command Luiz Augusto von Dentz
2022-02-15  0:39 ` [v2,BlueZ] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).